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.
1 parent 45c0099 commit 006ddf9Copy full SHA for 006ddf9
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
@@ -221,7 +222,9 @@ def do_expire(self):
221
222
"""
223
Expire objects assuming now == time
224
- for key, value in self.timeouts.items():
225
+ # Deep copy to avoid RuntimeError: dictionary changed size during iteration
226
+ _timeouts = deepcopy(self.timeouts)
227
+ for key, value in _timeouts.items():
228
if value - self.clock.now() < timedelta(0):
229
del self.timeouts[key]
230
# removing the expired key
0 commit comments