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

Function handleBlockedClientsTimeout

app/redis-6.2.6/src/timeout.c:136–154  ·  view source on GitHub ↗

This function is called in beforeSleep() in order to unblock clients * that are waiting in blocking operations with a timeout set. */

Source from the content-addressed store, hash-verified

134/* This function is called in beforeSleep() in order to unblock clients
135 * that are waiting in blocking operations with a timeout set. */
136void handleBlockedClientsTimeout(void) {
137 if (raxSize(server.clients_timeout_table) == 0) return;
138 uint64_t now = mstime();
139 raxIterator ri;
140 raxStart(&ri,server.clients_timeout_table);
141 raxSeek(&ri,"^",NULL,0);
142
143 while(raxNext(&ri)) {
144 uint64_t timeout;
145 client *c;
146 decodeTimeoutKey(ri.key,&timeout,&c);
147 if (timeout >= now) break; /* All the timeouts are in the future. */
148 c->flags &= ~CLIENT_IN_TO_TABLE;
149 checkBlockedClientTimeout(c,now);
150 raxRemove(server.clients_timeout_table,ri.key,ri.key_len,NULL);
151 raxSeek(&ri,"^",NULL,0);
152 }
153 raxStop(&ri);
154}
155
156/* Get a timeout value from an object and store it into 'timeout'.
157 * The final timeout is always stored as milliseconds as a time where the

Callers 1

beforeSleepFunction · 0.85

Calls 9

raxSizeFunction · 0.85
raxStartFunction · 0.85
raxSeekFunction · 0.85
raxNextFunction · 0.85
decodeTimeoutKeyFunction · 0.85
raxRemoveFunction · 0.85
raxStopFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected