[minor] Add QueueRepositoryInterface with memory and file-backed adapters #62
@@ -102,9 +102,7 @@ class FileBackedQueueAdapter(QueueRepositoryInterface):
|
||||
if added:
|
||||
self._append_items(added)
|
||||
if self._config.age_key is not None:
|
||||
cutoff = datetime.now(UTC) - timedelta(
|
||||
hours=self._config.max_age_hours
|
||||
)
|
||||
cutoff = datetime.now(UTC) - timedelta(hours=self._config.max_age_hours)
|
||||
if self._memory.evict_older_than(cutoff):
|
||||
self._compact()
|
||||
|
||||
|
||||
@@ -102,11 +102,15 @@ def test_parse_age_naive_datetime() -> None:
|
||||
|
||||
|
||||
def test_parse_age_zulu_string() -> None:
|
||||
assert _parse_age("2024-01-01T00:00:00Z") == datetime(2024, 1, 1, 0, 0, 0, tzinfo=UTC)
|
||||
assert _parse_age("2024-01-01T00:00:00Z") == datetime(
|
||||
2024, 1, 1, 0, 0, 0, tzinfo=UTC
|
||||
)
|
||||
|
||||
|
||||
def test_parse_age_naive_string() -> None:
|
||||
assert _parse_age("2024-01-01T00:00:00") == datetime(2024, 1, 1, 0, 0, 0, tzinfo=UTC)
|
||||
assert _parse_age("2024-01-01T00:00:00") == datetime(
|
||||
2024, 1, 1, 0, 0, 0, tzinfo=UTC
|
||||
)
|
||||
|
||||
|
||||
def test_dequeue_rejects_negative_max_items() -> None:
|
||||
|
||||
Reference in New Issue
Block a user