From ba1a40aa0af6f31ec7a077a305f0e37f3c72f7a6 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 23 May 2018 20:03:51 +0100 Subject: [PATCH] Fix race condition when setting PackageRelease.task_id --- app/views/packages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/packages.py b/app/views/packages.py index 521589b9..c6ebcb06 100644 --- a/app/views/packages.py +++ b/app/views/packages.py @@ -24,6 +24,7 @@ from app.tasks.importtasks import importRepoScreenshot, makeVCSRelease from app.utils import * +from celery import uuid from urllib.parse import urlparse from flask_wtf import FlaskForm from wtforms import * @@ -415,9 +416,10 @@ def create_release_page(package): rel.package = package rel.title = form["title"].data rel.url = "" + rel.task_id = uuid() db.session.commit() - rel.task_id = makeVCSRelease.delay(rel.id, form["vcsLabel"].data).id + makeVCSRelease.apply_async((rel.id, form["vcsLabel"].data), task_id=rel.task_id) msg = "{}: Release {} created".format(package.title, rel.title) triggerNotif(package.author, current_user, msg, rel.getEditURL())