How can I disconnect from redis BRPOP?

Let’s assume Redis.BlockingDequeueItemFromLists(timeout) is currently blocking.

Is there a way to immediately disconnect the blocked connection from another thread (without waiting for the timeout)?

There is no option to drop blocking operation, because it’s blocked on Redis and even if you kill the thread, at the next using BlockingDequeueItemFromLists you can get the data you would not expect to receive.

To unblock blocked operation you can define some special stop processing & exit word and when client receive it from the list then client stops further processing. With this logic you’ll be able to push the word into the list using EnqueueItemToList or PushItemToList and unblock the client before timeout will occur.