misc: don't use skip_locked if not supported by database (#31264)

This commit is contained in:
Frédéric Péters 2019-03-11 11:01:37 +01:00
parent 9bcc8d7a06
commit fbacbcfcf7
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ from django.apps import apps
from django.conf import settings
from django.core.exceptions import ValidationError, ObjectDoesNotExist, PermissionDenied
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.db import connection, models, transaction
from django.db.models import Q
from django.test import override_settings
from django.utils.text import slugify
@ -454,7 +454,7 @@ class BaseResource(models.Model):
# "jobs" cron job to run asynchronous tasks
resource_type = ContentType.objects.get_for_model(self)
skip_locked = {'skip_locked': True}
if django.VERSION < (1, 11, 0):
if django.VERSION < (1, 11, 0) or not connection.features.has_select_for_update_skip_locked:
skip_locked = {}
skipped_jobs = []
while True: