• Mikaël Salson's avatar
    task.py: Get updated database version · ef909825
    Mikaël Salson authored
    This commit fixes the issue of having STOPPED jobs stuck in that state.
    I have assumptions on why the commit fixes the issue but no certainty.
    
    When entering the `schedule_run` controller, web2py loads the database
    in its current state. If someone then clicks on  to run the sample
    that is currently being preprocessed, the task will be put in STOPPED
    state to wait for the preprocess to finish.
    Once the preprocess is finished, we query the DB to know which
    tasks have been stopped. But as the DB has been loaded at the start
    of the controller, it is not up-to-date anymore and doesn't
    get all the STOPPED jobs. Doing a db.commit() just before
    querying the STOPPED jobs could refresh the loaded DB.
    
    Fix #2053.
    ef909825
task.py 27.3 KB