changeset 2397:6f023afd6c16

dead code
author drewp@bigasterisk.com
date Thu, 16 May 2024 16:12:58 -0700
parents 8e0ae92d918d
children 87de3fada483
files src/light9/background_loop.py
diffstat 1 files changed, 8 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/light9/background_loop.py	Thu May 16 16:12:28 2024 -0700
+++ b/src/light9/background_loop.py	Thu May 16 16:12:58 2024 -0700
@@ -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 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 @@
 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]