Clean up more lock DB

This commit is contained in:
cuom1999 2024-01-13 18:40:10 -06:00
parent ad73e4cdf3
commit 3457eff339
3 changed files with 9 additions and 15 deletions

View file

@ -23,7 +23,6 @@ from reversion import revisions
from reversion.models import Revision, Version
from django_ratelimit.decorators import ratelimit
from judge.dblock import LockModel
from judge.models import Comment, Notification
from judge.widgets import HeavyPreviewPageDownWidget
from judge.jinja2.reference import get_user_from_text

View file

@ -12,7 +12,6 @@ from judge.models.bookmark import BookMark, MakeBookMark
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.detail import SingleObjectMixin
from judge.dblock import LockModel
from django.views.generic import View, ListView

View file

@ -25,7 +25,6 @@ from reversion.models import Version
from django.conf import settings
from django_ratelimit.decorators import ratelimit
from judge.dblock import LockModel
from judge.models import Comment, CommentVote, Notification, BlogPost
from judge.utils.views import TitleMixin
from judge.widgets import MathJaxPagedownWidget, HeavyPreviewPageDownWidget
@ -83,11 +82,8 @@ def vote_comment(request, delta):
try:
vote.save()
except IntegrityError:
with LockModel(write=(CommentVote,)):
try:
vote = CommentVote.objects.get(
comment_id=comment_id, voter=request.profile
)
vote = CommentVote.objects.get(comment_id=comment_id, voter=request.profile)
except CommentVote.DoesNotExist:
raise Http404()
if -vote.score != delta: