util.CallbackManager: handle callbacks being cancelled
was getting log spam when running the pycharm debugger in certain cases:
```
3.29 | E | concurrent.futures | exception calling callback for <Future at 0x1d4987bcc70 state=cancelled>
Traceback (most recent call last):
File "...\Python310\lib\concurrent\futures\_base.py", line 342, in _invoke_callbacks
callback(self)
File "...\electrum\electrum\util.py", line 1785, in on_done
if exc := fut_.exception():
File "...\Python310\lib\concurrent\futures\_base.py", line 485, in exception
raise CancelledError()
concurrent.futures._base.CancelledError
```
This commit is contained in:
@@ -1782,7 +1782,9 @@ class CallbackManager(Logger):
|
||||
def on_done(fut_: concurrent.futures.Future):
|
||||
assert fut_.done()
|
||||
self._running_cb_futs.remove(fut_)
|
||||
if exc := fut_.exception():
|
||||
if fut_.cancelled():
|
||||
self.logger.debug(f"cb cancelled. {event=}.")
|
||||
elif exc := fut_.exception():
|
||||
self.logger.error(f"cb errored. {event=}. {exc=}", exc_info=exc)
|
||||
fut.add_done_callback(on_done)
|
||||
else: # non-async cb
|
||||
|
||||
Reference in New Issue
Block a user