From 94e2103bf55692606714ccde6cb9f70d8d6988d7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 15 Mar 2022 10:45:51 -0400 Subject: [PATCH] Be mega-tolerant to feed consumer disconnects --- piker/data/_sampling.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/piker/data/_sampling.py b/piker/data/_sampling.py index e52fd93a..928b3694 100644 --- a/piker/data/_sampling.py +++ b/piker/data/_sampling.py @@ -1,5 +1,5 @@ # piker: trading gear for hackers -# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0) +# Copyright (C) 2018-present Tyler Goodlet (in stewardship of pikers) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -403,7 +403,16 @@ async def uniform_rate_send( # rate timing exactly lul try: await stream.send({sym: first_quote}) - except trio.ClosedResourceError: + except ( + # NOTE: any of these can be raised by ``tractor``'s IPC + # transport-layer and we want to be highly resilient + # to consumers which crash or lose network connection. + # I.e. we **DO NOT** want to crash and propagate up to + # ``pikerd`` these kinds of errors! + trio.ClosedResourceError, + trio.BrokenResourceError, + ConnectionResetError, + ): # if the feed consumer goes down then drop # out of this rate limiter log.warning(f'{stream} closed')