mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 15:05:48 +00:00
fix: use event instead of chained timer for daemon
Old solution causes amount of thread to be growing as well as stack is increased during each iteration. Instead of cycle-free implementation, this commit just uses while cycle
This commit is contained in:
@ -43,8 +43,10 @@ class Daemon(Handler):
|
||||
report(bool): force enable or disable reporting
|
||||
"""
|
||||
from ahriman.application.handlers import Update
|
||||
Update.run(args, repository_id, configuration, report=report)
|
||||
timer = threading.Timer(args.interval, Daemon.run, args=[args, repository_id, configuration],
|
||||
kwargs={"report": report})
|
||||
timer.start()
|
||||
timer.join()
|
||||
|
||||
event = threading.Event()
|
||||
try:
|
||||
while not event.wait(args.interval):
|
||||
Update.run(args, repository_id, configuration, report=report)
|
||||
except KeyboardInterrupt:
|
||||
pass # normal exit
|
||||
|
Reference in New Issue
Block a user