From e9cd9d1163310499507fada98052cb2a5aafbb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 7 Mar 2025 21:54:11 +0100 Subject: [PATCH] Increase delay between transaction retries Since c8771e45b861 the retry is no more a countdown but an increasing count, so the sleep time must be adapted to also increase over retries. Closes #13910 --- trytond/trytond/protocols/dispatcher.py | 2 +- trytond/trytond/protocols/wrappers.py | 2 +- trytond/trytond/worker.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/trytond/trytond/protocols/dispatcher.py b/trytond/trytond/protocols/dispatcher.py index 3fb11efe62..e71374f4d2 100644 --- a/trytond/trytond/protocols/dispatcher.py +++ b/trytond/trytond/protocols/dispatcher.py @@ -201,7 +201,7 @@ def _dispatch(request, pool, *args, **kwargs): transaction_extras = {} while True: if count: - time.sleep(0.02 * (retry - count)) + time.sleep(0.02 * count) with Transaction().start( pool.database_name, user, readonly=rpc.readonly, timeout=rpc.timeout, diff --git a/trytond/trytond/protocols/wrappers.py b/trytond/trytond/protocols/wrappers.py index 85ea999b49..9b5140899b 100644 --- a/trytond/trytond/protocols/wrappers.py +++ b/trytond/trytond/protocols/wrappers.py @@ -246,7 +246,7 @@ def with_transaction(readonly=None, user=0, context=None, timeout=None): transaction_extras = {} while True: if count: - time.sleep(0.02 * (retry - count)) + time.sleep(0.02 * count) with Transaction().start( pool.database_name, user_, readonly=readonly_, context=context_, timeout=timeout, diff --git a/trytond/trytond/worker.py b/trytond/trytond/worker.py index ab85f1427b..57322fed86 100644 --- a/trytond/trytond/worker.py +++ b/trytond/trytond/worker.py @@ -145,7 +145,7 @@ def run_task(pool, task_id): transaction_extras = {} while True: if count: - time.sleep(0.02 * (retry - count)) + time.sleep(0.02 * count) with Transaction().start( pool.database_name, 0, **transaction_extras) as transaction: