Skip to content
Snippets Groups Projects
Commit 03d91740 authored by Martin Mareš's avatar Martin Mareš
Browse files

Ještě jedna oprava garbage collectoru

parent 4e8fb78c
No related branches found
No related tags found
No related merge requests found
......@@ -172,6 +172,12 @@ app.before_request(init_request)
### UWSGI glue ###
def collect_garbage() -> None:
mo.now = mo.util.get_now()
mo.jobs.process_jobs()
mo.users.expire_reg_requests()
# Čas od času se probudíme a spustíme garbage collector:
# - projdeme joby pro případ, že by se ztratil signál
# - expirujeme zastaralé joby
......@@ -179,10 +185,7 @@ app.before_request(init_request)
@app.cli.command('gc')
def gc():
"""Run garbage collector."""
mo.now = mo.util.get_now()
mo.jobs.process_jobs()
mo.users.expire_reg_requests()
collect_garbage()
try:
......@@ -193,7 +196,7 @@ try:
def mule_timer(signum):
# app.logger.debug('Mule: Timer tick')
with app.app_context():
gc()
collect_garbage()
# Obykle při vložení jobu dostaneme signál.
@signal(42, target='mule')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment