We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a02fcd0 + 006ddf9 commit 8fba948Copy full SHA for 8fba948
mockredis/client.py
@@ -1,5 +1,6 @@
1
from __future__ import division
2
from collections import defaultdict
3
+from copy import deepcopy
4
from itertools import chain
5
from datetime import datetime, timedelta
6
from hashlib import sha1
@@ -229,7 +230,9 @@ def do_expire(self):
229
230
"""
231
Expire objects assuming now == time
232
- for key, value in self.timeouts.items():
233
+ # Deep copy to avoid RuntimeError: dictionary changed size during iteration
234
+ _timeouts = deepcopy(self.timeouts)
235
+ for key, value in _timeouts.items():
236
if value - self.clock.now() < timedelta(0):
237
del self.timeouts[key]
238
# removing the expired key
0 commit comments