Suppress `trio.EndOfChannel`s raised by remote peer
Since now `tractor` will raise this native `trio`-exc translated from a `Stop` msg when the peer gracefully terminates a `tractor.MsgStream`. Just `info()` log in such cases versus continuing to warn for the others.service_mng_to_tractor
parent
5e371f1d73
commit
e8c0485d99
|
@ -394,7 +394,8 @@ async def register_with_sampler(
|
|||
finally:
|
||||
if (
|
||||
sub_for_broadcasts
|
||||
and subs
|
||||
and
|
||||
subs
|
||||
):
|
||||
try:
|
||||
subs.remove(stream)
|
||||
|
@ -796,7 +797,6 @@ async def uniform_rate_send(
|
|||
clear_types = _tick_groups['clears']
|
||||
|
||||
while True:
|
||||
|
||||
# compute the remaining time to sleep for this throttled cycle
|
||||
left_to_sleep = throttle_period - diff
|
||||
|
||||
|
@ -891,11 +891,23 @@ async def uniform_rate_send(
|
|||
# ``pikerd`` these kinds of errors!
|
||||
trio.ClosedResourceError,
|
||||
trio.BrokenResourceError,
|
||||
trio.EndOfChannel,
|
||||
ConnectionResetError,
|
||||
):
|
||||
) as ipc_err:
|
||||
match ipc_err:
|
||||
case trio.EndOfChannel():
|
||||
log.info(
|
||||
f'{stream} terminated by peer,\n'
|
||||
f'{ipc_err!r}'
|
||||
)
|
||||
case _:
|
||||
# if the feed consumer goes down then drop
|
||||
# out of this rate limiter
|
||||
log.warning(f'{stream} closed')
|
||||
log.warning(
|
||||
f'{stream} closed due to,\n'
|
||||
f'{ipc_err!r}'
|
||||
)
|
||||
|
||||
await stream.aclose()
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue