Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Sitecore scheduled task - last run time updates even though the task hasn't run ?

I have a scheduled task set up in the sitecore content editor that is set to run ever 5 minutes. 20100901T235900|20200101T235900|127|00:05:00 The frequency I have set up in the web.config is check every minute.

<frequency>00:01:00</frequency>
<agent type="Sitecore.Tasks.DatabaseAgent" method="Run" interval="00:01:00">
<param desc="database">master</param>
<param desc="schedule root">/sitecore/system/tasks/schedules</param>
<LogActivity>true</LogActivity>
</agent> 

The problem seems to be that the last run time keeps updating every 5 minutes regardless of whether or not sitecore has checked to see if its due or not. So the time keeps updating and then sitecore checks to see if its due and alway says "not due" and never runs. I have confirmed that the Sitecore server and DB server system times are in sync. Does anyone know why the last run time would update even though sitecore has not run the task? As a troubleshooting note. If I watch the logs and note i.e. that the last time it checked to see if it was due was 12:00:15. Then I go into the content editor and change the last run time to "an hour ago" or "a day ago" and wait until just before 12:05:15 to save the change. Then the task scheduler has not had time to update the last run time and sitecore picks up the task and runs it. I can see it in the logs. It will then run about 4 or 5 more times on the 5 minute mark but then reverts back to the same issue. I have to think it is because eventually sitecore no longer checks on the 15 second mark and there ends up being too big of a time interval between the two.

Any help would be greatly appreciated. Thanks.

like image 324
David Smith Avatar asked Nov 07 '13 14:11

David Smith


1 Answers

Do you have more than 1 instance of web application connecting to the same database?

E.g. more than 1 developer using same database. Maybe some of the tasks are executed on another machine not on yours?

This is the most common scenario in which such a problem happens. Remember that Sitecore stores information about tasks execution in database and if you have multiple web applications using the same database, only one of them (and random each time) will execute tasks.

like image 58
Marek Musielak Avatar answered Nov 07 '22 06:11

Marek Musielak