Sitecore Database Agent

From my last few posts, I have been talking about the Sitecore Tasks. Using the Sitecore Tasks allow a user to either set the task as synchronous or asynchronous. It is the Sitecore.Tasks.DatabaseAgent which runs at a define interval and loops through the container /sitecore/system/tasks/schedules.

When jobs are being executed, if it is synchronous, the entry in the jobs.aspx page will be as Master_Database_Agent (5 of 7). This means that of the 7 jobs that has been scheduled, it is at the 5th task.

What is the 4th, 5th or 7th task?

Right now, we don’t know which task is being executed unless we go and check the logs. You just need to make sure that the logger level is INFO. This is a Sitecore out of the box functionality.

But from a usability perspective, you will want to have the name of the task being executed when you check the jobs.aspx page. I will be explaining on how you can add the name of the task to the jobs.aspx page.

First, you need to extend the current Tasks.DatabaseAgent class.

The main change in the code is at line 41. The change will only apply for synchronous tasks.