diff --git a/src/xapi/tests/tests.py b/src/xapi/tests/tests.py index f843760d19f21e56cc04061ebae19e8923f8cd32..2c96796e71896ec07d71116faac1eb17156c97f9 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 5de3b36e5be9fa83aaed05009c1edb97884d38f4..540a0f8a7491e95ec6e5e23fa79cb5ea71423124 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 "")