fix: 推送系统用户时 AdHocExecution id 重复

pull/5280/head
xinwen 4 years ago
parent b3642f3ff4
commit bf308e24b6

@ -180,8 +180,10 @@ class AdHoc(OrgModelMixin):
def run(self): def run(self):
try: try:
hid = current_task.request.id hid = current_task.request.id
if AdHocExecution.objects.filter(id=hid).exists():
hid = uuid.uuid4()
except AttributeError: except AttributeError:
hid = str(uuid.uuid4()) hid = uuid.uuid4()
execution = AdHocExecution( execution = AdHocExecution(
id=hid, adhoc=self, task=self.task, id=hid, adhoc=self, task=self.task,
task_display=str(self.task)[:128], task_display=str(self.task)[:128],

@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
from common.utils import get_logger, get_object_or_none from common.utils import get_logger, get_object_or_none
from common.tasks import send_mail_async from common.tasks import send_mail_async
from orgs.utils import tmp_to_org, org_aware_func from orgs.utils import org_aware_func
from .models import Task, AdHoc from .models import Task, AdHoc

Loading…
Cancel
Save