Skip to content

Commit

Permalink
Merge pull request #697 from opengisch/QF-2638-repeatable-read
Browse files Browse the repository at this point in the history
Set dequeue transaction level to repeatable read so we have stable data
  • Loading branch information
suricactus authored and m-kuhn committed Jun 22, 2023
1 parent 29efcdf commit add9467
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docker-app/qfieldcloud/core/management/commands/dequeue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from django.db import transaction
from django.db import connection, transaction
from qfieldcloud.core.models import Job
from worker_wrapper.wrapper import (
DeltaApplyJobRun,
Expand Down Expand Up @@ -51,6 +51,9 @@ def handle(self, *args, **options):
queued_job = None

with transaction.atomic():
with connection.cursor() as cursor:
cursor.execute("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ")

busy_projects_ids_qs = Job.objects.filter(
status__in=[
Job.Status.QUEUED,
Expand Down

0 comments on commit add9467

Please sign in to comment.