Skip to content

Commit

Permalink
feat: add max_instances for apscheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
verdel committed Sep 5, 2023
1 parent ae054c7 commit a983207
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/config.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ db:

schedule:
check_period: 10
max_instances: 1
9 changes: 8 additions & 1 deletion transmission_telegram_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,18 @@ def main():
check_period = int(cfg["schedule"]["check_period"])
else:
check_period = 60
if "max_instances" in cfg["schedule"]:
max_instances = int(cfg["schedule"]["max_instances"])
else:
max_instances = 1
else:
check_period = 60
max_instances = 1

if job_queue:
job_queue.run_repeating(check_torrent_download_status, interval=check_period, first=10)
job_queue.run_repeating(
check_torrent_download_status, interval=check_period, first=10, job_kwargs={"max_instances": max_instances}
)
application.run_polling()


Expand Down

0 comments on commit a983207

Please sign in to comment.