mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-21 12:36:36 +00:00
Merge pull request #765 from tcely/patch-3
Upgrade to 1.2.8 for Django 5 support
This commit is contained in:
commit
a57b92b5b1
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Python ${{ matrix.python-version }}
|
- name: Install Python ${{ matrix.python-version }}
|
||||||
|
4
Pipfile
4
Pipfile
@ -7,7 +7,7 @@ verify_ssl = true
|
|||||||
autopep8 = "*"
|
autopep8 = "*"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
django = "~=3.2"
|
django = "*"
|
||||||
django-sass-processor = "*"
|
django-sass-processor = "*"
|
||||||
libsass = "*"
|
libsass = "*"
|
||||||
pillow = "*"
|
pillow = "*"
|
||||||
@ -15,7 +15,7 @@ whitenoise = "*"
|
|||||||
gunicorn = "*"
|
gunicorn = "*"
|
||||||
django-compressor = "*"
|
django-compressor = "*"
|
||||||
httptools = "*"
|
httptools = "*"
|
||||||
django-background-tasks = "==1.2.5"
|
django-background-tasks = ">=1.2.8"
|
||||||
django-basicauth = "*"
|
django-basicauth = "*"
|
||||||
psycopg2-binary = "*"
|
psycopg2-binary = "*"
|
||||||
mysqlclient = "*"
|
mysqlclient = "*"
|
||||||
|
@ -6,8 +6,8 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from compat import StringIO
|
from io import StringIO
|
||||||
from compat.models import GenericForeignKey
|
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@ -50,7 +50,8 @@ class TaskManager(models.Manager):
|
|||||||
if queue:
|
if queue:
|
||||||
qs = qs.filter(queue=queue)
|
qs = qs.filter(queue=queue)
|
||||||
ready = qs.filter(run_at__lte=now, failed_at=None)
|
ready = qs.filter(run_at__lte=now, failed_at=None)
|
||||||
_priority_ordering = '{}priority'.format(app_settings.BACKGROUND_TASK_PRIORITY_ORDERING)
|
_priority_ordering = '{}priority'.format(
|
||||||
|
app_settings.BACKGROUND_TASK_PRIORITY_ORDERING)
|
||||||
ready = ready.order_by(_priority_ordering, 'run_at')
|
ready = ready.order_by(_priority_ordering, 'run_at')
|
||||||
|
|
||||||
if app_settings.BACKGROUND_TASK_RUN_ASYNC:
|
if app_settings.BACKGROUND_TASK_RUN_ASYNC:
|
||||||
@ -102,7 +103,8 @@ class TaskManager(models.Manager):
|
|||||||
s = "%s%s" % (task_name, task_params)
|
s = "%s%s" % (task_name, task_params)
|
||||||
task_hash = sha1(s.encode('utf-8')).hexdigest()
|
task_hash = sha1(s.encode('utf-8')).hexdigest()
|
||||||
if remove_existing_tasks:
|
if remove_existing_tasks:
|
||||||
Task.objects.filter(task_hash=task_hash, locked_at__isnull=True).delete()
|
Task.objects.filter(task_hash=task_hash,
|
||||||
|
locked_at__isnull=True).delete()
|
||||||
return Task(task_name=task_name,
|
return Task(task_name=task_name,
|
||||||
task_params=task_params,
|
task_params=task_params,
|
||||||
task_hash=task_hash,
|
task_hash=task_hash,
|
||||||
@ -251,7 +253,8 @@ class Task(models.Model):
|
|||||||
self.failed_at = timezone.now()
|
self.failed_at = timezone.now()
|
||||||
logger.warning('Marking task %s as failed', self)
|
logger.warning('Marking task %s as failed', self)
|
||||||
completed = self.create_completed_task()
|
completed = self.create_completed_task()
|
||||||
task_failed.send(sender=self.__class__, task_id=self.id, completed_task=completed)
|
task_failed.send(sender=self.__class__,
|
||||||
|
task_id=self.id, completed_task=completed)
|
||||||
self.delete()
|
self.delete()
|
||||||
else:
|
else:
|
||||||
backoff = timedelta(seconds=(self.attempts ** 4) + 5)
|
backoff = timedelta(seconds=(self.attempts ** 4) + 5)
|
||||||
@ -330,9 +333,6 @@ class Task(models.Model):
|
|||||||
db_table = 'background_task'
|
db_table = 'background_task'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CompletedTaskQuerySet(models.QuerySet):
|
class CompletedTaskQuerySet(models.QuerySet):
|
||||||
|
|
||||||
def created_by(self, creator):
|
def created_by(self, creator):
|
||||||
@ -389,7 +389,8 @@ class CompletedTask(models.Model):
|
|||||||
# when the task should be run
|
# when the task should be run
|
||||||
run_at = models.DateTimeField(db_index=True)
|
run_at = models.DateTimeField(db_index=True)
|
||||||
|
|
||||||
repeat = models.BigIntegerField(choices=Task.REPEAT_CHOICES, default=Task.NEVER)
|
repeat = models.BigIntegerField(
|
||||||
|
choices=Task.REPEAT_CHOICES, default=Task.NEVER)
|
||||||
repeat_until = models.DateTimeField(null=True, blank=True)
|
repeat_until = models.DateTimeField(null=True, blank=True)
|
||||||
|
|
||||||
# the "name" of the queue this is to be run on
|
# the "name" of the queue this is to be run on
|
||||||
|
Loading…
Reference in New Issue
Block a user