[minor] Add QueueRepositoryInterface with memory and file-backed adapters #62

Merged
brian merged 5 commits from cursor/queue-adapters into main 2026-07-16 21:27:51 +02:00
2 changed files with 7 additions and 5 deletions
Showing only changes of commit 1822d886b1 - Show all commits
@@ -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()
+6 -2
View File
@@ -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: