Commit 30fbdd3d authored by Julien Muchembled's avatar Julien Muchembled

CMFActivity: in case of ConflictError, retry earlier than for other failures

This tweaks retry delays as follows (seconds):

        ConflictError  other failures (K = 1 + retry², with retry >= 0)
before     30             15 * K
after      15             30 * K

Today, bigger delays in case of errors should not be an issue because the
quality of ERP5 has improved a lot and normal code should not rely anymore on
this.

We also don't want to lower ConflictError delay too much, because this
increase the probability of conflicts.

This will be required to improve invokeGroup, in case that a message fails.
We'd like that:
- successful messages are retried immediately
- skipped messages are retried next, and separately
- at last, failed messages are retried, also separately
parent 0571cbab
...@@ -43,7 +43,7 @@ INVALID_ORDER = 2 ...@@ -43,7 +43,7 @@ INVALID_ORDER = 2
# Time global parameters # Time global parameters
MAX_PROCESSING_TIME = 900 # in seconds MAX_PROCESSING_TIME = 900 # in seconds
VALIDATION_ERROR_DELAY = 30 # in seconds VALIDATION_ERROR_DELAY = 15 # in seconds
class Queue(object): class Queue(object):
""" """
......
...@@ -586,7 +586,7 @@ class SQLBase(Queue): ...@@ -586,7 +586,7 @@ class SQLBase(Queue):
delay = m.delay delay = m.delay
if delay is None: if delay is None:
# By default, make delay quadratic to the number of retries. # By default, make delay quadratic to the number of retries.
delay = VALIDATION_ERROR_DELAY * (retry * retry + 1) / 2 delay = VALIDATION_ERROR_DELAY * (retry * retry + 1) * 2
try: try:
# Immediately update, because values different for every message # Immediately update, because values different for every message
activity_tool.SQLBase_reactivate(table=self.sql_table, activity_tool.SQLBase_reactivate(table=self.sql_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment