Added max-requests, reduced log output, timing tweak in scheduling operation

pull/336/head
Piero Toffanin 2017-11-20 13:44:52 -05:00
rodzic a77854888e
commit 4408fc6ad2
3 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -26,7 +26,6 @@ def boot():
booted.value = True
logger = logging.getLogger('app.logger')
logger.info("Booting...")
if settings.DEBUG:
logger.warning("Debug mode is ON (for development this is OK)")

Wyświetl plik

@ -16,7 +16,7 @@ from app.background import background
logger = logging.getLogger('app.logger')
scheduler = BackgroundScheduler({
'apscheduler.job_defaults.coalesce': 'false',
'apscheduler.job_defaults.coalesce': 'true',
'apscheduler.job_defaults.max_instances': '3',
})
@ -43,7 +43,6 @@ def process_pending_tasks():
Q(Q(status=None) | Q(status__in=[status_codes.QUEUED, status_codes.RUNNING]), processing_node__isnull=False) |
Q(pending_action__isnull=False)).exclude(Q(processing_lock=True))
for task in tasks:
logger.info("Acquiring lock: {}".format(task))
task.processing_lock = True
task.save()
finally:
@ -80,12 +79,11 @@ def cleanup_projects():
logger.info("Deleted {} projects".format(count_dict['app.Project']))
def setup():
logger.info("Starting background scheduler...")
try:
scheduler.start()
scheduler.add_job(update_nodes_info, 'interval', seconds=30)
scheduler.add_job(process_pending_tasks, 'interval', seconds=5)
scheduler.add_job(cleanup_projects, 'interval', seconds=15)
scheduler.add_job(cleanup_projects, 'interval', seconds=60)
except SchedulerAlreadyRunningError:
logger.warning("Scheduler already running (this is OK while testing)")

Wyświetl plik

@ -113,7 +113,7 @@ else
congrats
nginx -c $(pwd)/nginx/$conf
gunicorn webodm.wsgi --bind unix:/tmp/gunicorn.sock --timeout 360 --preload
gunicorn webodm.wsgi --bind unix:/tmp/gunicorn.sock --timeout 360 --max-requests 250 --preload
fi
# If this is executed, it means the previous command failed, don't display the congratulations message