[v3.5] Task not running

Re: [v3.5] Task not running

by Anze Pratnemer -
Number of replies: 0

I went a step further and tried running via CLI with :

/usr/bin/php html/admin/tool/task/cli/schedule_task.php --execute=\\local_studissync\\task\\worker


which always returns: "Cannot obtain task lock". I tried setting blocking in task config to 1, but that didn't change anything. I added:

public function get_run_if_component_disabled(){

return true;

}

just in case my plugin is somehow disabled and I don't see that, but that didnt change outcome.


Then I stumbled upon this page: https://www.linuxito.com/gnu-linux/nivel-alto/686-resolver-cannot-obtain-task-lock-en-moodle which suggested that process may be stuck somehow. And it was true. I hade a cron.php task running from 2 weeks ago. Once killed, task is being run via cron on a scheduled time.


Now I have to check, why process gets stuck. I am getting data from 3rd party API, which sometimes gets unresponsive. Maybe I need to handle this exception.


So, this one is solved, writing followup just in case somebody else gets same problem.


Both of responsers, thank you for your time, you both contributed to finding solution..


Average of ratings: Useful (2)