Handle logging against IPC stream vs. throttled channel on overruns

misc_backend_fixes
Tyler Goodlet 2022-01-23 19:40:00 -05:00
parent 47d0c81a2d
commit 8e390278f5
1 changed files with 11 additions and 5 deletions

View File

@ -253,11 +253,17 @@ async def sample_and_broadcast(
try:
stream.send_nowait((sym, quote))
except trio.WouldBlock:
log.warning(
f'Feed overrun {bus.brokername} ->'
f'{stream._ctx.channel.uid} !!!'
)
ctx = getattr(sream, '_ctx', None)
if ctx:
log.warning(
f'Feed overrun {bus.brokername} ->'
f'{ctx.channel.uid} !!!'
)
else:
log.warning(
f'Feed overrun {bus.brokername} -> '
f'feed @ {tick_throttle} Hz'
)
else:
await stream.send({sym: quote})