23 lines
617 B
Python
23 lines
617 B
Python
import time
|
|
from logging_config import get_logger
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
class Scheduler:
|
|
def __init__(self, processor, config):
|
|
self.processor = processor
|
|
self.config = config
|
|
|
|
def run(self):
|
|
logger.info("Scheduler started")
|
|
while True:
|
|
try:
|
|
self.processor.process()
|
|
except Exception:
|
|
logger.exception("Processing cycle failed")
|
|
|
|
logger.info(
|
|
"Sleeping for %s minutes", self.config.poll_interval_minutes
|
|
)
|
|
time.sleep(self.config.poll_interval_minutes * 60)
|
|
`` |