Skip to content

Commit

Permalink
Ensures that the overdrive new titles script does not fail when cover…
Browse files Browse the repository at this point in the history
…age records are added.
  • Loading branch information
dbernstein committed Sep 11, 2024
1 parent 3784c8f commit 650814a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/palace/manager/core/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def run_once(self, progress, count_as_covered=None):
transient_failures,
persistent_failures,
), results = self.process_batch_and_handle_results(batch_results)

self.finalize_batch()
# Update the running totals so that the service's eventual timestamp
# will have a useful .achievements.
progress.successes += successes
Expand Down Expand Up @@ -486,9 +486,6 @@ def process_batch_and_handle_results(self, batch):
num_ignored,
)

# Finalize this batch before moving on to the next one.
self.finalize_batch()

# For all purposes outside this method, treat an ignored identifier
# as a transient failure.
transient_failures += num_ignored
Expand Down Expand Up @@ -910,6 +907,7 @@ def run_on_specific_identifiers(self, identifiers):
while index < len(need_coverage):
batch = need_coverage[index : index + self.batch_size]
(s, t, p), r = self.process_batch_and_handle_results(batch)
self.finalize_batch()
successes += s
transient_failures += t
persistent_failures += p
Expand Down
6 changes: 0 additions & 6 deletions tests/manager/core/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,6 @@ def test_process_batch_and_handle_results(self, db: DatabaseTransactionFixture):
class MockProvider1(AlwaysSuccessfulCoverageProvider):
OPERATION = "i succeed"

def finalize_batch(self):
self.finalized = True

success_provider = MockProvider1(db.session)

batch = [i1, i2]
Expand All @@ -546,9 +543,6 @@ def finalize_batch(self):
# Two successes.
assert (2, 0, 0) == counts

# finalize_batch() was called.
assert True == success_provider.finalized

# Each represented with a CoverageRecord with status='success'
assert all(isinstance(x, CoverageRecord) for x in successes)
assert [CoverageRecord.SUCCESS] * 2 == [x.status for x in successes]
Expand Down

0 comments on commit 650814a

Please sign in to comment.