mirror of
https://github.com/aljazceru/IngestRSS.git
synced 2025-12-18 22:44:27 +01:00
Add Docker infrastructure for local services
This commit is contained in:
27
local_services/scheduler.py
Normal file
27
local_services/scheduler.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
import time
|
||||
import logging
|
||||
import importlib
|
||||
|
||||
handler = importlib.import_module(
|
||||
'src.infra.lambdas.RSSQueueFiller.lambda.lambda_function'
|
||||
).handler
|
||||
|
||||
logging.basicConfig(level=os.getenv("LOG_LEVEL", "INFO"))
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
INTERVAL_MINUTES = int(os.getenv("SCHEDULER_INTERVAL_MINUTES", "240"))
|
||||
|
||||
|
||||
def main():
|
||||
logger.info("Starting scheduler loop")
|
||||
while True:
|
||||
try:
|
||||
handler({}, None)
|
||||
except Exception as exc:
|
||||
logger.exception("Scheduler job failed: %s", exc)
|
||||
time.sleep(INTERVAL_MINUTES * 60)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user