Retry on DB deadlock when updating story

Updating the updated_at time of a story when creating a new task seems to be prone to deadlocks, which results in the task not getting created. This patch retries the update thrice.

Change-Id: I1e657d9eb64717f1dfbaf53d843675ee686c774d
Task: 4141
Signed-off-by: Riju19 <19.riju@gmail.com>
This commit is contained in:
Riju19 2019-04-08 11:12:42 +05:30
parent 686cc9f8ef
commit 5ad890854c

View File

@ -16,6 +16,8 @@
import datetime
import pytz
from oslo_db import api as oslo_db_api
from sqlalchemy.orm import subqueryload
from storyboard._i18n import _
@ -274,6 +276,8 @@ def get_project_ids(story_id, current_user=None):
return project_ids
@oslo_db_api.wrap_db_retry(max_retries=3, retry_on_deadlock=True,
retry_interval=0.5, inc_retry_interval=True)
def story_update_updated_at(story_id):
session = api_base.get_session()
with session.begin(subtransactions=True):