Skip to content

Commit

Permalink
fix: stop resetting the embargo queue on flush
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdh committed Jan 18, 2024
1 parent b79af99 commit 78968ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions dataimporter/lib/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,8 @@ def iter_changed(self) -> Iterable[SourceRecord]:

def flush(self):
"""
Remove all expired embargo IDs from the embargo queue and remove all IDs from
the main view queue.
Remove all IDs from the main view queue.
"""
self.embargoes.flush_released(now())
self.changes.clear()

def rebuild(self):
Expand Down
6 changes: 2 additions & 4 deletions tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ def test_iter_changed(self, view: View):

def test_flush(self, view: View):
records = [
# use int_to_str to maintain the sort order
SourceRecord(i, {"a": i}, "test")
for i in sorted(map(str, range(100)))
SourceRecord(i, {"a": i}, "test") for i in sorted(map(str, range(100)))
]
records.append(SourceRecord("100", {"NhmSecEmbargoDate": "2025-02-05"}, "test"))

Expand All @@ -272,7 +270,7 @@ def test_flush(self, view: View):
view.flush()

assert view.count() == 0
assert view.embargoes.size() == 0
assert view.embargoes.size() == 1

@freeze_time("2024/10/16")
def test_rebuild(self, view: View):
Expand Down

0 comments on commit 78968ea

Please sign in to comment.