Skip to content

Commit

Permalink
🐛 adjust look_back duration correctly by setting max value
Browse files Browse the repository at this point in the history
  • Loading branch information
ff137 committed Aug 20, 2024
1 parent 615d380 commit c90355c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/tests/util/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async def check_webhook_state(
attempt = 0

while not event and attempt < max_tries:
look_back_duration = min(30, look_back + attempt * max_duration)
try:
if filter_map:
# Assuming that filter_map contains 1 key-value pair
Expand All @@ -61,14 +62,14 @@ async def check_webhook_state(
field_id=field_id,
desired_state=state,
timeout=max_duration,
look_back=look_back + attempt * max_duration, # scale per attempt
look_back=look_back_duration,
)
else:
bound_logger.info("Waiting for event with state {}", state)
event = await listener.wait_for_state(
desired_state=state,
timeout=max_duration,
look_back=look_back + attempt * max_duration, # scale per attempt
look_back=look_back_duration,
)
except SseListenerTimeout:
bound_logger.error(
Expand Down

0 comments on commit c90355c

Please sign in to comment.