# HG changeset patch # User drewp@bigasterisk.com # Date 2024-05-16 23:12:58 # Node ID 6f023afd6c1614c1bbf7dcc425a02ff9ec419443 # Parent 8e0ae92d918dc5703c7b59298e67d715bc3a2b61 dead code diff --git a/src/light9/background_loop.py b/src/light9/background_loop.py --- a/src/light9/background_loop.py +++ b/src/light9/background_loop.py @@ -1,4 +1,4 @@ -# dev copy +# this is a fork of https://bigasterisk.com/code/background_loop/files/tip/ import asyncio import logging import time @@ -9,23 +9,7 @@ from prometheus_client import Gauge, Sum from light9.recentfps import RecentFps from braillegraph import horizontal_graph -log = logging.getLogger('loop') - - -# throw this away (when net_routes is rewritten) -def loop_forever_sync(func, sleep_period, up_metric): - first_run = True - while True: - try: - func(first_run) - up_metric.set(1) - first_run = False - except Exception as ex: - log.error(ex) - traceback.print_exc() - up_metric.set(0) - time.sleep(sleep_period) - +log = logging.getLogger() _created = [] @@ -33,10 +17,12 @@ def loop_forever_sync(func, sleep_period F_RET = Any F_KWARGS = Any -UserAsyncFunc = Callable[..., # always called with at least kwarg first_run=bool - Awaitable[F_RET]] -UserSyncFunc = Callable[..., # see above - F_RET] +UserAsyncFunc = Callable[ + ..., # always called with at least kwarg first_run=bool + Awaitable[F_RET]] +UserSyncFunc = Callable[ + ..., # see above + F_RET] UserFunc = Union[UserAsyncFunc, UserSyncFunc]