MCPcopy Create free account
hub / github.com/F-Stack/f-stack / blockClient

Function blockClient

app/redis-6.2.6/src/blocked.c:89–106  ·  view source on GitHub ↗

Block a client for the specific operation type. Once the CLIENT_BLOCKED * flag is set client query buffer is not longer processed, but accumulated, * and will be processed when the client is unblocked. */

Source from the content-addressed store, hash-verified

87 * flag is set client query buffer is not longer processed, but accumulated,
88 * and will be processed when the client is unblocked. */
89void blockClient(client *c, int btype) {
90 /* Master client should never be blocked unless pause or module */
91 serverAssert(!(c->flags & CLIENT_MASTER &&
92 btype != BLOCKED_MODULE &&
93 btype != BLOCKED_PAUSE));
94
95 c->flags |= CLIENT_BLOCKED;
96 c->btype = btype;
97 server.blocked_clients++;
98 server.blocked_clients_by_type[btype]++;
99 addClientToTimeoutTable(c);
100 if (btype == BLOCKED_PAUSE) {
101 listAddNodeTail(server.paused_clients, c);
102 c->paused_list_node = listLast(server.paused_clients);
103 /* Mark this client to execute its command */
104 c->flags |= CLIENT_PENDING_COMMAND;
105 }
106}
107
108/* This function is called after a client has finished a blocking operation
109 * in order to update the total command duration, log the command into

Callers 4

blockForKeysFunction · 0.85
waitCommandFunction · 0.85
processCommandFunction · 0.85
moduleBlockClientFunction · 0.85

Calls 2

addClientToTimeoutTableFunction · 0.85
listAddNodeTailFunction · 0.85

Tested by

no test coverage detected