mirror of
https://github.com/smittix/intercept.git
synced 2026-07-20 23:38:10 -07:00
style: document cleanup now-capture and widen test sleep margin
This commit is contained in:
+2
-2
@@ -81,9 +81,9 @@ class TestDataStoreCleanup:
|
|||||||
|
|
||||||
def test_cleanup_removes_expired_keeps_fresh(self):
|
def test_cleanup_removes_expired_keeps_fresh(self):
|
||||||
"""Test that cleanup removes expired entries and keeps fresh ones."""
|
"""Test that cleanup removes expired entries and keeps fresh ones."""
|
||||||
store = DataStore(max_age_seconds=0.001, name="test")
|
store = DataStore(max_age_seconds=0.05, name="test")
|
||||||
store.set("old", 1)
|
store.set("old", 1)
|
||||||
time.sleep(0.01)
|
time.sleep(0.06)
|
||||||
store.set("new", 2)
|
store.set("new", 2)
|
||||||
|
|
||||||
removed = store.cleanup()
|
removed = store.cleanup()
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ class DataStore:
|
|||||||
Returns:
|
Returns:
|
||||||
Number of entries removed
|
Number of entries removed
|
||||||
"""
|
"""
|
||||||
|
# Capture now once so both the scan and re-validation use the same cutoff.
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
|
|||||||
Reference in New Issue
Block a user