from huey import Huey, crontab from .. import HUEY, create_app def create_consumer() -> Huey: """ Create and configure the Huey consumer. The application is initialized, task modules are imported to register their tasks, and the source scanner is registered with the configured periodic schedule. :return: Configured Huey instance. """ app = create_app() from . import receiver, scanner, sender # noqa: F401 schedule = crontab( *app.config["WEBMENTIONS_SSG_SCANNER_SCHEDULE"].split(), strict=True ) HUEY.periodic_task(schedule)(scanner.scan_sources) return HUEY.huey huey = create_consumer()