CLIENT UNBLOCK
CLIENT UNBLOCK client-id [TIMEOUT | ERROR]
- Group
- Connection
- Arity
- -3 (at least 3 words, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
CLIENT UNBLOCK ends a blocking command, such as BLPOP,
BZPOPMIN or XREAD with BLOCK,
that another connection is waiting in. Use it to wake a worker that you want
to stop or reconfigure without waiting for its timeout.
Options
Section titled “Options”| Option | Effect |
|---|---|
client-id |
The id of the blocked connection, see CLIENT ID. |
TIMEOUT |
The blocked command returns as if its timeout had expired. This is the default. |
ERROR |
The blocked command fails with UNBLOCKED client unblocked via CLIENT UNBLOCK. |
Return value
Section titled “Return value”| Case | Reply (RESP2 and RESP3) |
|---|---|
| The connection was blocked and is now unblocked | Integer 1 |
| No such connection, or it is not blocked | Integer 0 |
client-id is not an integer |
Error ERR value is not an integer or out of range |
Reason is not TIMEOUT or ERROR |
Error ERR CLIENT UNBLOCK reason should be TIMEOUT or ERROR |
Examples
Section titled “Examples”In one connection:
127.0.0.1:6379> CLIENT ID(integer) 21127.0.0.1:6379> BLPOP jobs 0In another:
127.0.0.1:6379> CLIENT UNBLOCK 21 ERROR(integer) 1The first connection then gets:
(error) UNBLOCKED client unblocked via CLIENT UNBLOCKCompatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.