diff --git a/poller/poll.py b/poller/poll.py index c692358..f346ecd 100644 --- a/poller/poll.py +++ b/poller/poll.py @@ -136,6 +136,8 @@ def loop(run: Callable[[], int], every: int, log=print, sleep=time.sleep) -> Non run() except Exception as e: # noqa: BLE001 — the poller must outlive a failed run log(f"run failed: {_describe(e)}") + if isinstance(e, urllib.error.HTTPError): + e.close() sleep(every)