From 37cdb1675d43734e0ff2494e91a1ef8158ab25f5 Mon Sep 17 00:00:00 2001 From: aliqandil Date: Thu, 24 Oct 2024 21:23:08 +0330 Subject: [PATCH] new task bug fixed --- asyncron/workers.py | 4 +++- setup.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/asyncron/workers.py b/asyncron/workers.py index 6e0c125..4a9aa0d 100644 --- a/asyncron/workers.py +++ b/asyncron/workers.py @@ -107,7 +107,9 @@ class AsyncronWorker: from .models import Task for func in Task.registered_tasks.values(): task = func.task - if not task.pk: task.pk = Task.objects.get( name = task.name ).pk + if not task.pk: + try: task.pk = Task.objects.get( name = task.name ).pk + except Task.DoesNotExist: pass #It's a new one, it's fine. self.attach_django_signals() diff --git a/setup.py b/setup.py index 2be4329..566ba50 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='asyncron', - version='0.1.2', + version='0.1.3', packages=find_packages(), #include_package_data=True, # Include static files from MANIFEST.in install_requires=[