Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Kehl committed Jan 13, 2025
1 parent 1ea89ab commit f4b8c04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions app/celery/scheduled_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,20 @@ def process_delivery_receipts(self):
)
print(f"DELIVERED {delivered_receipts} FAILED {failed_receipts}")
delivered_receipts = list(delivered_receipts)
print(f"DELIVERED LIST {delivered_receipts}")
for i in range(0, len(delivered_receipts), batch_size):
batch = delivered_receipts[i : i + batch_size]
print("UPDATING DELIVERY RECEIPTS")
dao_update_delivery_receipts(batch, True)
print("DEIVERY RECEIPTS UPDATED")
failed_receipts = list(failed_receipts)
for i in range(0, len(failed_receipts), batch_size):
print("UDPATING FAILED RECEIPTS")
batch = failed_receipts[i : i + batch_size]
dao_update_delivery_receipts(batch, False)
print("FAILED RECEITPS UPDATED")
except Exception as ex:
print(f"EXCEPTION {ex}")
retry_count = self.request.retries
wait_time = 3600 * 2**retry_count
try:
Expand Down
3 changes: 0 additions & 3 deletions tests/app/celery/test_scheduled_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,6 @@ def test_process_delivery_receipts_success(mocker):
processor.retry = MagicMock()

processor.process_delivery_receipts()

cloudwatch_mock.check_delivery_receipts.assert_called_once()

assert dao_update_mock.call_count == 3
dao_update_mock.assert_any_call(list(range(1000)), True)
dao_update_mock.assert_any_call(list(range(1000, 2000)), True)
Expand Down

0 comments on commit f4b8c04

Please sign in to comment.