youtube-channel-manager/YtManagerApp/scheduler.py

21 lines
505 B
Python
Raw Normal View History

2018-10-10 22:43:50 +00:00
import logging
from apscheduler.schedulers.background import BackgroundScheduler
2018-10-13 20:01:45 +00:00
from .appconfig import settings
2018-10-10 22:43:50 +00:00
instance: BackgroundScheduler = None
def initialize_scheduler():
global instance
logger = logging.getLogger('scheduler')
executors = {
'default': {
'type': 'threadpool',
2018-10-13 20:01:45 +00:00
'max_workers': settings.getint('global', 'SchedulerConcurrency')
2018-10-10 22:43:50 +00:00
}
}
instance = BackgroundScheduler(logger=logger, executors=executors)
instance.start()