Changeset - 6f023afd6c16
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 8 months ago 2024-05-16 23:12:58
drewp@bigasterisk.com
dead code
1 file changed with 6 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/light9/background_loop.py
Show inline comments
 
# 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,9 +17,11 @@ def loop_forever_sync(func, sleep_period
 
F_RET = Any
 
F_KWARGS = Any
 

	
 
UserAsyncFunc = Callable[...,  # always called with at least kwarg first_run=bool
 
UserAsyncFunc = Callable[
 
    ...,  # always called with at least kwarg first_run=bool
 
                         Awaitable[F_RET]]
 
UserSyncFunc = Callable[...,  # see above
 
UserSyncFunc = Callable[
 
    ...,  # see above
 
                        F_RET]
 
UserFunc = Union[UserAsyncFunc, UserSyncFunc]
 

	
0 comments (0 inline, 0 general)