Task running every minute blocks all others

Task running every minute blocks all others

by Howard Miller -
Number of replies: 4
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Scenario - scheduled task is set up to run every minute. The cron runs every minute. The task is custom and sends a small amount of data to an external web service. 

The external web service fails. 

The upshot seems to be that this blocks all other Scheduled tasks. I find this very surprising. Is this likely? Is there some stupid mistake I have made handling the failure in the task logic? Something else?

Average of ratings: -
In reply to Howard Miller

Re: Task running every minute blocks all others

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Nowadays scheduled tasks can run simultaneously.

If your scheduled task is using a configuration with blocking = 1, then no other scheduled task will run at the same time as this task, so you can avoid this by configuring blocking = 0.

If the task fails, then the task will be retried after 1 minute. If the task keeps failing, the retry algorithm will automatically add more time between each successive attempts (24 hr max). So a properly configured task should not block other tasks.

R
Average of ratings: Useful (2)
In reply to Renaat Debleu

Re: Task running every minute blocks all others

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It's not blocking. Which is why I was surprised.

I need to do more investigation. I just wondered if anybody had encountered anything similar
In reply to Howard Miller

Re: Task running every minute blocks all others

by Neill Magill -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
I only recall a plugins task blocking others from ever running when it caused a fatal error.
In reply to Neill Magill

Re: Task running every minute blocks all others

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This is Curl attempting to access a SOAP WSDL link. It times out. My guess is that the length of the timeout is resulting in too many parallel processes and that's stopping other tasks getting a look in.

Well... it's the only theory I have