From 5cae9c3d068943076d628d8605e5e30ff5d01966 Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Tue, 25 Jun 2024 15:57:50 +0100 Subject: [PATCH] FIX: Get retry count correctly in flask app skipci --- octue/cloud/deployment/google/cloud_run/flask_app.py | 2 +- tests/cloud/deployment/google/cloud_run/test_flask_app.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/octue/cloud/deployment/google/cloud_run/flask_app.py b/octue/cloud/deployment/google/cloud_run/flask_app.py index 7cebdea5d..b0d06ab34 100644 --- a/octue/cloud/deployment/google/cloud_run/flask_app.py +++ b/octue/cloud/deployment/google/cloud_run/flask_app.py @@ -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.", diff --git a/tests/cloud/deployment/google/cloud_run/test_flask_app.py b/tests/cloud/deployment/google/cloud_run/test_flask_app.py index a5fa080c8..c3b687c63 100644 --- a/tests/cloud/deployment/google/cloud_run/test_flask_app.py +++ b/tests/cloud/deployment/google/cloud_run/test_flask_app.py @@ -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}}], ), ] ) @@ -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}}], ), ] )