Skip to content

Commit

Permalink
Increase total number of retries and max wait between retries
Browse files Browse the repository at this point in the history
  • Loading branch information
samdoran committed Jun 26, 2024
1 parent 3f0c4d2 commit d2897b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions koku/masu/management/commands/migrate_trino_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ def get_all_schemas() -> list[str]:


def run_trino_sql(sql, schema=None) -> list[t.Optional[list[int]]]:
retries = 5
retries = 8
for n in range(1, retries + 1):
attempt = n
remaining_retries = retries - n
# Exponential backoff with a little bit of randomness and a
# minimum wait of 0.5 and max wait of 7
wait = (min(2**n, 7) + secrets.randbelow(1000) / 1000) or 0.5
wait = (min(2**n, 12) + secrets.randbelow(1000) / 1000) or 0.5
try:
with trino_db.connect(schema=schema) as conn:
cur = conn.cursor()
Expand Down

0 comments on commit d2897b4

Please sign in to comment.