Skip to content

Commit

Permalink
Log TimeoutErrors. Fetch timeout 200ms
Browse files Browse the repository at this point in the history
  • Loading branch information
wdbasson committed Feb 19, 2025
1 parent 86ebf0a commit ea0a902
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion waypoint/services/nats_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async def event_generator(*, subscription: JetStreamContext.PullSubscription):

try:
messages = await subscription.fetch(
batch=5, timeout=0.5, heartbeat=0.2
batch=5, timeout=0.5, heartbeat=0.01
)
for message in messages:
event = orjson.loads(message.data)
Expand All @@ -185,6 +185,7 @@ async def event_generator(*, subscription: JetStreamContext.PullSubscription):
await asyncio.sleep(0.1)

except TimeoutError:
bound_logger.error("<><><>TimeoutError<><><>")
if nr_of_timeout_errors == 5:
bound_logger.warning(
"Subscription lost connection, attempting to resubscribe..."
Expand Down

0 comments on commit ea0a902

Please sign in to comment.