From 3d21f8a86432e3025e56188af7b060c6914b1766 Mon Sep 17 00:00:00 2001 From: Benjamin Ledel <benjamin.ledel@digitallearning.gmbh> Date: Wed, 18 Dec 2024 22:30:07 +0100 Subject: [PATCH] Update 2 files - /src/xapi/tests/tests.py - /src/xapi/views.py --- src/xapi/tests/tests.py | 2 ++ src/xapi/views.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xapi/tests/tests.py b/src/xapi/tests/tests.py index f843760..2c96796 100644 --- a/src/xapi/tests/tests.py +++ b/src/xapi/tests/tests.py @@ -22,6 +22,8 @@ PROJECT_PATH = os.path.abspath(os.path.dirname(__name__)) def mock_store_in_lrs(x_api_statement): return True +def mock_store_in_lrs(x_api_statement): + return True class XAPITestCase(TestCase): test_user_email = "test@mail.com" diff --git a/src/xapi/views.py b/src/xapi/views.py index 5de3b36..540a0f8 100644 --- a/src/xapi/views.py +++ b/src/xapi/views.py @@ -333,7 +333,7 @@ class CreateStatement(APIView): except Exception as e: if settings.DEBUG: print("Could not forward to ", additional_lrs["url"], ":", e) - if not res or res.status_code != 200: + if (not res or res.status_code != 200) and not settings.CELERY_TASK_ALWAYS_EAGER: retry_forward_statements.delay(x_api_statements, additional_lrs["token_type"], additional_lrs["token"], additional_lrs["url"]) if settings.DEBUG: print("Could not forward to ", additional_lrs["url"], ":", res.reason if res is not None else "URL could not be reached", "({})".format(res.status_code) if res is not None else "") -- GitLab