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: try:
stream.send_nowait((sym, quote)) stream.send_nowait((sym, quote))
except trio.WouldBlock: except trio.WouldBlock:
log.warning( ctx = getattr(sream, '_ctx', None)
f'Feed overrun {bus.brokername} ->' if ctx:
f'{stream._ctx.channel.uid} !!!' 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: else:
await stream.send({sym: quote}) await stream.send({sym: quote})