summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorJim Brunner <brunnerj@amazon.com>2020-08-10 22:36:34 -0700
committerGitHub <noreply@github.com>2020-08-10 22:36:34 -0700
commitf39c9404a397d7c48a6e8347666f9d037861db60 (patch)
treea9657a3856d98d0f618e65917a1bd626243f5a60 /src/dict.c
parent229327ad8be5cd87ead56884228dfb08b6017c45 (diff)
downloadredis-f39c9404a397d7c48a6e8347666f9d037861db60.tar.gz
Prevent dictRehashMilliseconds from rehashing while a safe iterator is present (#5948)
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index 45aab66f9..a26ef18d3 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -239,6 +239,8 @@ long long timeInMilliseconds(void) {
/* Rehash for an amount of time between ms milliseconds and ms+1 milliseconds */
int dictRehashMilliseconds(dict *d, int ms) {
+ if (d->iterators > 0) return 0;
+
long long start = timeInMilliseconds();
int rehashes = 0;