MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / addClientToTimeoutTable

Function addClientToTimeoutTable

src/timeout.cpp:115–122  ·  view source on GitHub ↗

Add the specified client id / timeout as a key in the radix tree we use * to handle blocked clients timeouts. The client is not added to the list * if its timeout is zero (block forever). */

Source from the content-addressed store, hash-verified

113 * to handle blocked clients timeouts. The client is not added to the list
114 * if its timeout is zero (block forever). */
115void addClientToTimeoutTable(client *c) {
116 if (c->bpop.timeout == 0) return;
117 uint64_t timeout = c->bpop.timeout;
118 unsigned char buf[CLIENT_ST_KEYLEN];
119 encodeTimeoutKey(buf,timeout,c);
120 if (raxTryInsert(g_pserver->clients_timeout_table,buf,sizeof(buf),NULL,NULL))
121 c->flags |= CLIENT_IN_TO_TABLE;
122}
123
124/* Remove the client from the table when it is unblocked for reasons
125 * different than timing out. */

Callers 1

blockClientFunction · 0.85

Calls 2

encodeTimeoutKeyFunction · 0.85
raxTryInsertFunction · 0.85

Tested by

no test coverage detected