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

Function updateStatsOnUnblock

src/blocked.cpp:115–123  ·  view source on GitHub ↗

This function is called after a client has finished a blocking operation * in order to update the total command duration, log the command into * the Slow log if needed, and log the reply duration event if needed. */

Source from the content-addressed store, hash-verified

113 * in order to update the total command duration, log the command into
114 * the Slow log if needed, and log the reply duration event if needed. */
115void updateStatsOnUnblock(client *c, long blocked_us, long reply_us){
116 const ustime_t total_cmd_duration = c->duration + blocked_us + reply_us;
117 c->lastcmd->microseconds += total_cmd_duration;
118
119 /* Log the command into the Slow log if needed. */
120 slowlogPushCurrentCommand(c, c->lastcmd, total_cmd_duration);
121 /* Log the reply duration event. */
122 latencyAddSampleIfNeeded("command-unblocking",reply_us/1000);
123}
124
125/* This function is called in the beforeSleep() function of the event loop
126 * in order to process the pending input buffer of clients that were

Calls 1

Tested by

no test coverage detected