From cb6f3bb0fe4068308337e449edcd55927cae0761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 17 May 2017 12:50:13 +0200 Subject: [PATCH] [Backport] Revert "Making update_attr_in_bulk_for_ids work in asynch mode if possible" This reverts commit 479454cbde2e29ac175d3b72f6588d3a394ce71c. --- taiga/base/utils/db.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/taiga/base/utils/db.py b/taiga/base/utils/db.py index cd4a7a15..809c9d9c 100644 --- a/taiga/base/utils/db.py +++ b/taiga/base/utils/db.py @@ -16,13 +16,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db import connection from django.db import DatabaseError from django.db import transaction from django.shortcuts import _get_queryset -from taiga.celery import app from . import functions @@ -124,9 +122,9 @@ def update_in_bulk(instances, list_of_new_values, callback=None, precall=None): instance.save() callback(instance) -@app.task + @transaction.atomic -def _update_attr_in_bulk_for_ids(values, attr, model): +def update_attr_in_bulk_for_ids(values, attr, model): """Update a table using a list of ids. :params values: Dict of new values where the key is the pk of the element to update. @@ -164,14 +162,6 @@ def _update_attr_in_bulk_for_ids(values, attr, model): transaction.on_commit(_run_sql) -@transaction.atomic -def update_attr_in_bulk_for_ids(values, attr, model): - if settings.CELERY_ENABLED: - _update_attr_in_bulk_for_ids.delay(values, attr, model) - else: - _update_attr_in_bulk_for_ids(values, attr, model) - - def to_tsquery(term): """ Based on: https://gist.github.com/wolever/1a5ccf6396f00229b2dc