2

I have a sitecore scheduler job running every 60 minutes, It used to be every 10 minutes but after testing I changed it to run every 60 minutes

<agent type="XYZ.Scheduler.AdviserSync" method="Run" interval="00:60:00"></agent>

It worked fine few days but then stopped working, today I chekd in the log files and I found this entry.

6032 15:15:19 INFO Scheduler - Skipping inactive agent: XYZ.Scheduler.AdviserSync

I also write some log entries when job starts but I can;t find them in log files, looks like job is not running.

Question:

Is interval configured properly? Why scheduler job automatically stopped running? Is there any setting I need to configure to run it properly?

2

Scheduler - Skypping inactive agent

is generated by Sitecore.Task.Scheduler.ReadAgents class

private static Scheduler.Agent[] ReadAgents()
{
    Log.Info("Scheduler - Adding agents", typeof(Scheduler));
    try
    {
        ArrayList arrayList = new ArrayList();
        XmlNodeList configNodes = Factory.GetConfigNodes("scheduling/agent");
        foreach (XmlNode xmlNode in configNodes)
        {
            try
            {
                object obj = Factory.CreateObject(xmlNode, true);
                string @string = StringUtil.GetString(new string[]
                {
                    XmlUtil.GetAttribute("method", xmlNode),
                    "Execute"
                });
                TimeSpan timeSpan = DateUtil.ParseTimeSpan(XmlUtil.GetAttribute("interval", xmlNode), TimeSpan.FromSeconds(0.0), CultureInfo.InvariantCulture);
                string string2 = StringUtil.GetString(new string[]
                {
                    XmlUtil.GetAttribute("name", xmlNode),
                    obj.GetType().FullName
                });
                bool @bool = MainUtil.GetBool(XmlUtil.GetAttribute("async", xmlNode), false);
                if (timeSpan.TotalSeconds > 0.0)
                {
                    Log.Info(string.Concat(new object[]
                    {
                        "Scheduler - Adding agent: ",
                        string2,
                        " (interval: ",
                        timeSpan,
                        ")"
                    }), typeof(Scheduler));
                    Scheduler.Agent value;
                    if (@bool)
                    {
                        value = new Scheduler.AsyncAgent(string2, obj, @string, timeSpan, Scheduler.m_startTime);
                    }
                    else
                    {
                        value = new Scheduler.Agent(string2, obj, @string, timeSpan, Scheduler.m_startTime);
                    }
                    arrayList.Add(value);
                }
                else
                {
                    Log.Info("Scheduler - Skipping inactive agent: " + string2, typeof(Scheduler));
                }
            }
            catch (Exception exception)
            {
                Log.Error("Error while instantiating agent. Definition: " + xmlNode.OuterXml, exception, typeof(Scheduler));
            }
        }
        Log.Info("Scheduler - Agents added", typeof(Scheduler));
        return arrayList.ToArray(typeof(Scheduler.Agent)) as Scheduler.Agent[];
    }
    catch (Exception exception2)
    {
        Log.Error("Error while reading agents.", exception2, typeof(Scheduler));
    }
    return null;
}

On sitecore code it reads the interval and test if the value is not 00:00 :

TimeSpan timeSpan = DateUtil.ParseTimeSpan(XmlUtil.GetAttribute("interval", xmlNode), TimeSpan.FromSeconds(0.0), CultureInfo.InvariantCulture);

    if (timeSpan.TotalSeconds > 0.0)
            { 
                  // sitecore code
            }
            else
            {
                //if interval is 0 it skips the agent
               Log.Info("Scheduler - Skipping inactive agent: " + string2, typeof(Scheduler));

            }

Please have a look to your config files using : yourhost/sitecore/admin/showconfig.aspx and verify the value of interval. I recommend to change the value from 00:60:00 to 00:59:59

  • Probably 00:60:00 is being treated as 0.0 seconds which clearly is not zero, I have changed it to 59:59, I have to wait for an house to see the update. – Ali Jun 7 '18 at 4:30
  • I suggest you to change for testing to 00:09:59 . – Vlad Iobagiu Jun 7 '18 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.