"""Constants for backoff strategies.""" from config import ASYNC_CHUNK_SIZE # The worst case backoff time for a failing graphql call is 7s. # We need to make sure that the timeout for the any task is greater than # the backoff time for the worst case scenario for each GraphQL call # multiplied by the number of calls per task (ASYNC_CHUNK_SIZE). We should # also add a little buffer for software lag / network delays. There is one # call per task, so the timeout should be: # # (WORST_CASE_BACKOFF * CALLS_PER_TASK * ASYNC_CHUNK_SIZE) + BUFFER # WORST_CASE_BACKOFF = 7 # Seconds CALLS_PER_TASK = 1 BUFFER = ASYNC_CHUNK_SIZE # TASK_TIMEOUT = max( # (WORST_CASE_BACKOFF * CALLS_PER_TASK * ASYNC_CHUNK_SIZE) + BUFFER, # 30 # ) TASK_TIMEOUT = 600 # Seconds # Backoff strategy knobs BASE = 3 FACTOR = 2 MAX_TRIES = 10 MAX_TIME = 30 MAX_VALUE = 10