diff options
Diffstat (limited to 'webmentions_ssg/tasks/consumer.py')
| -rw-r--r-- | webmentions_ssg/tasks/consumer.py | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/webmentions_ssg/tasks/consumer.py b/webmentions_ssg/tasks/consumer.py index 474e775..362ebe8 100644 --- a/webmentions_ssg/tasks/consumer.py +++ b/webmentions_ssg/tasks/consumer.py @@ -21,23 +21,14 @@ def create_consumer() -> Huey: """ app = create_app() - schedule = crontab(*app.config["SCANNER_SCHEDULE"].split(), strict=True) - queue.periodic_task(schedule)(scanner.scan_sources) - - recovery_schedule = crontab( - *app.config["VERIFICATION_REAPER_SCHEDULE"].split(), strict=True - ) - queue.periodic_task(recovery_schedule)(receiver.recover_stale_webmentions) - - notification_schedule = crontab( - *app.config["NOTIFICATION_SCHEDULE"].split(), strict=True - ) - queue.periodic_task(notification_schedule)(notifications.send_webmention_digest) - - retention_schedule = crontab( - *app.config["RECEIVED_RETENTION_SCHEDULE"].split(), strict=True - ) - queue.periodic_task(retention_schedule)(retention.purge_old_received_webmentions) + for config_key, task in ( + ("SCANNER_SCHEDULE", scanner.scan_sources), + ("VERIFICATION_REAPER_SCHEDULE", receiver.recover_stale_webmentions), + ("NOTIFICATION_SCHEDULE", notifications.send_webmention_digest), + ("RECEIVED_RETENTION_SCHEDULE", retention.purge_old_received_webmentions), + ): + schedule = crontab(*app.config[config_key].split(), strict=True) + queue.periodic_task(schedule)(task) return queue.huey |
