Try slowing down rejudge enqueue

This commit is contained in:
cuom1999 2023-05-20 10:06:00 +09:00
parent 966e8c9db5
commit d80ec962a5

View file

@ -1,6 +1,7 @@
from celery import shared_task from celery import shared_task
from django.core.cache import cache from django.core.cache import cache
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from time import sleep
from judge.models import Problem, Profile, Submission from judge.models import Problem, Profile, Submission
from judge.utils.celery import Progress from judge.utils.celery import Progress
@ -34,6 +35,7 @@ def rejudge_problem_filter(
for submission in queryset.iterator(): for submission in queryset.iterator():
submission.judge(rejudge=True, batch_rejudge=True) submission.judge(rejudge=True, batch_rejudge=True)
rejudged += 1 rejudged += 1
sleep(0.1)
if rejudged % 10 == 0: if rejudged % 10 == 0:
p.done = rejudged p.done = rejudged
return rejudged return rejudged