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
Branches
No related tags found
No related merge requests found
...@@ -172,6 +172,12 @@ app.before_request(init_request) ...@@ -172,6 +172,12 @@ app.before_request(init_request)
### UWSGI glue ### ### 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: # Čas od času se probudíme a spustíme garbage collector:
# - projdeme joby pro případ, že by se ztratil signál # - projdeme joby pro případ, že by se ztratil signál
# - expirujeme zastaralé joby # - expirujeme zastaralé joby
...@@ -179,10 +185,7 @@ app.before_request(init_request) ...@@ -179,10 +185,7 @@ app.before_request(init_request)
@app.cli.command('gc') @app.cli.command('gc')
def gc(): def gc():
"""Run garbage collector.""" """Run garbage collector."""
collect_garbage()
mo.now = mo.util.get_now()
mo.jobs.process_jobs()
mo.users.expire_reg_requests()
try: try:
...@@ -193,7 +196,7 @@ try: ...@@ -193,7 +196,7 @@ try:
def mule_timer(signum): def mule_timer(signum):
# app.logger.debug('Mule: Timer tick') # app.logger.debug('Mule: Timer tick')
with app.app_context(): with app.app_context():
gc() collect_garbage()
# Obykle při vložení jobu dostaneme signál. # Obykle při vložení jobu dostaneme signál.
@signal(42, target='mule') @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