Skip to content

Commit

Permalink
FIX: Get retry count correctly in flask app
Browse files Browse the repository at this point in the history
skipci
  • Loading branch information
cortadocodes committed Jun 25, 2024
1 parent 8fa3e68 commit 5cae9c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion octue/cloud/deployment/google/cloud_run/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _acknowledge_and_drop_redelivered_questions(question_uuid, retry_count):
for question in previous_question_attempts:

# Acknowledge questions that are redelivered to stop further redelivery and redundant processing.
if question["attributes"]["other_attributes"]["retry_count"] == retry_count:
if question["attributes"]["retry_count"] == retry_count:
logger.warning(
"Question %r (retry count %s) has already been received by the service. It will now be acknowledged to "
"prevent further redundant redelivery and dropped.",
Expand Down
4 changes: 2 additions & 2 deletions tests/cloud/deployment/google/cloud_run/test_flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_redelivered_questions_are_acknowledged_and_dropped(self):
patch("octue.configuration.ServiceConfiguration.from_file", return_value=MOCK_CONFIGURATION),
patch(
"octue.cloud.deployment.google.cloud_run.flask_app.get_events",
return_value=[{"attributes": {"other_attributes": {"retry_count": 0}}}],
return_value=[{"attributes": {"retry_count": 0}}],
),
]
)
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_retried_questions_are_allowed(self):
patch("octue.configuration.ServiceConfiguration.from_file", return_value=MOCK_CONFIGURATION),
patch(
"octue.cloud.deployment.google.cloud_run.flask_app.get_events",
return_value=[{"attributes": {"other_attributes": {"retry_count": 0}}}],
return_value=[{"attributes": {"retry_count": 0}}],
),
]
)
Expand Down

0 comments on commit 5cae9c3

Please sign in to comment.