fix: handle RuntimeError on trades download

asyncio raises RuntimeError if the handler is not set on
the main thread.

closes #12211
This commit is contained in:
Matthias
2025-09-06 18:09:26 +02:00
parent 5ddaea7efc
commit efed5700be

View File

@@ -3259,7 +3259,7 @@ class Exchange:
for sig in [signal.SIGINT, signal.SIGTERM]: for sig in [signal.SIGINT, signal.SIGTERM]:
try: try:
self.loop.add_signal_handler(sig, task.cancel) self.loop.add_signal_handler(sig, task.cancel)
except NotImplementedError: except (NotImplementedError, RuntimeError):
# Not all platforms implement signals (e.g. windows) # Not all platforms implement signals (e.g. windows)
pass pass
return self.loop.run_until_complete(task) return self.loop.run_until_complete(task)