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

Function moduleBlockedClientTimedOut

src/module.cpp:5801–5824  ·  view source on GitHub ↗

Called when our client timed out. After this function unblockClient() * is called, and it will invalidate the blocked client. So this function * does not need to do any cleanup. Eventually the module will call the * API to unblock the client and the memory will be released. */

Source from the content-addressed store, hash-verified

5799 * does not need to do any cleanup. Eventually the module will call the
5800 * API to unblock the client and the memory will be released. */
5801void moduleBlockedClientTimedOut(client *c) {
5802 RedisModuleBlockedClient *bc = (RedisModuleBlockedClient*)c->bpop.module_blocked_handle;
5803
5804 /* Protect against re-processing: don't serve clients that are already
5805 * in the unblocking list for any reason (including RM_UnblockClient()
5806 * explicit call). See #6798. */
5807 if (bc->unblocked) return;
5808
5809 RedisModuleCtx ctx = REDISMODULE_CTX_INIT;
5810 ctx.flags |= REDISMODULE_CTX_BLOCKED_TIMEOUT;
5811 ctx.module = bc->module;
5812 ctx.client = bc->client;
5813 ctx.blocked_client = bc;
5814 ctx.blocked_privdata = bc->privdata;
5815 bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
5816 moduleFreeContext(&ctx);
5817 if (!bc->blocked_on_keys) {
5818 updateStatsOnUnblock(c, bc->background_duration, 0);
5819 }
5820 /* For timeout events, we do not want to call the disconnect callback,
5821 * because the blocked client will be automatically disconnected in
5822 * this case, and the user can still hook using the timeout callback. */
5823 bc->disconnect_callback = NULL;
5824}
5825
5826/* Return non-zero if a module command was called in order to fill the
5827 * reply for a blocked client. */

Callers 2

RM_UnblockClientFunction · 0.85

Calls 2

moduleFreeContextFunction · 0.85
updateStatsOnUnblockFunction · 0.85

Tested by

no test coverage detected