summaryrefslogtreecommitdiff
path: root/src/blocked.c
diff options
context:
space:
mode:
authorMadelyn Olson <34459052+madolson@users.noreply.github.com>2023-03-29 19:58:51 -0700
committerGitHub <noreply@github.com>2023-03-29 19:58:51 -0700
commit971b177fa338fe06cb67a930c6e54467d29ec44f (patch)
tree441962ff76914ce9ea2ff97b2ab763568c8d62ab /src/blocked.c
parent0c3b8b7e90ea242640a417abb5c40f30dfc3e036 (diff)
downloadredis-971b177fa338fe06cb67a930c6e54467d29ec44f.tar.gz
Fixed tracking of command duration for multi/eval/module/wait (#11970)
In #11012, we changed the way command durations were computed to handle the same command being executed multiple times. This commit fixes some misses from that commit. * Wait commands were not correctly reporting their duration if the timeout was reached. * Multi/scripts/and modules with RM_Call were not properly resetting the duration between inner calls, leading to them reporting cumulative duration. * When a blocked client is freed, the call and duration are always discarded. This commit also adds an assert if the duration is not properly reset, potentially indicating that a report to call statistics was missed. The assert potentially be removed in the future, as it's mainly intended to detect misses in tests.
Diffstat (limited to 'src/blocked.c')
-rw-r--r--src/blocked.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/blocked.c b/src/blocked.c
index 7c10460b1..c9d5f230a 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -114,6 +114,7 @@ void updateStatsOnUnblock(client *c, long blocked_us, long reply_us, int had_err
updateCommandLatencyHistogram(&(c->lastcmd->latency_histogram), total_cmd_duration*1000);
/* Log the command into the Slow log if needed. */
slowlogPushCurrentCommand(c, c->lastcmd, total_cmd_duration);
+ c->duration = 0;
/* Log the reply duration event. */
latencyAddSampleIfNeeded("command-unblocking",reply_us/1000);
}