From c19f2609f44e7df905d8ca939be54862f704dd92 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sun, 19 Dec 2021 13:20:58 +0300 Subject: [PATCH] removed transaction --- Main/management/commands/receive.py | 13 +++---------- SprintLib/BaseView.py | 2 -- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Main/management/commands/receive.py b/Main/management/commands/receive.py index 62ddc4f..71a912e 100644 --- a/Main/management/commands/receive.py +++ b/Main/management/commands/receive.py @@ -1,5 +1,3 @@ -from time import sleep - import pika from django.core.management.base import BaseCommand @@ -20,15 +18,10 @@ class Command(BaseCommand): channel.queue_declare(queue="test") def callback(ch, method, properties, body): + id = int(str(body, encoding="utf-8")) + print(f"Received id {id}") + solution = Solution.objects.get(id=id) try: - id = int(str(body, encoding="utf-8")) - print(f"Received id {id}") - while True: - try: - solution = Solution.objects.get(id=id) - break - except: - sleep(0.5) eval(solution.language.work_name + "Tester")(solution).execute() except Exception as e: print(e) diff --git a/SprintLib/BaseView.py b/SprintLib/BaseView.py index 6a8089e..9251784 100644 --- a/SprintLib/BaseView.py +++ b/SprintLib/BaseView.py @@ -1,6 +1,5 @@ from typing import Optional -from django.db import transaction from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponseRedirect, JsonResponse from django.shortcuts import render @@ -23,7 +22,6 @@ class BaseView: @classmethod def as_view(cls): - @transaction.atomic def execute(request): if request.user.is_authenticated: user_info = request.user.userinfo