diff options
author | charsyam <charsyam@gmail.com> | 2018-02-14 00:12:13 +0900 |
---|---|---|
committer | charsyam <charsyam@gmail.com> | 2018-02-14 00:12:13 +0900 |
commit | 9d414361151922e25f3c2eacb8a02653dd85e0c9 (patch) | |
tree | 6c1c73e11160d9dd1bf68c45b1874874081cc8aa | |
parent | ae29bcd8e2b592ed89435a84eda8f03050050b75 (diff) | |
download | redis-9d414361151922e25f3c2eacb8a02653dd85e0c9.tar.gz |
getting rid of duplicated code
-rw-r--r-- | src/latency.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/latency.c b/src/latency.c index 1f43f906d..292720aa0 100644 --- a/src/latency.c +++ b/src/latency.c @@ -109,19 +109,19 @@ void latencyAddSample(char *event, mstime_t latency) { dictAdd(server.latency_events,zstrdup(event),ts); } + if (latency > ts->max) ts->max = latency; + /* If the previous sample is in the same second, we update our old sample * if this latency is > of the old one, or just return. */ prev = (ts->idx + LATENCY_TS_LEN - 1) % LATENCY_TS_LEN; if (ts->samples[prev].time == now) { if (latency > ts->samples[prev].latency) ts->samples[prev].latency = latency; - if (latency > ts->max) ts->max = latency; return; } ts->samples[ts->idx].time = time(NULL); ts->samples[ts->idx].latency = latency; - if (latency > ts->max) ts->max = latency; ts->idx++; if (ts->idx == LATENCY_TS_LEN) ts->idx = 0; |