1
votes

I'm trying to configure a task to run every 5 seconds (in production the fequency will be set to 30 minutes, but i set it to 5 seconds for debugging).

<scheduling>
  <!-- Time between checking for scheduled tasks waiting to execute -->
  <frequency>00:00:10</frequency>
....
<agent type="MyStuff.Sitecore.Tasks.UpdateJob" method="Run" interval="00:00:05">
        <LogActivity>true</LogActivity>
      </agent>

my class looks like:

namespace MyStuff.Sitecore.Tasks
{
    public class UpdateJob
    {
       public void Run()
       {
          //debugger never enters here
       }
    }
}

But no matter what, the code never seems to be invoked. I've tried hitting other webpages so i know the asp.net worker process is alive.

the class is in a shared library which is invoked in the web site project, so whatever sitecore configuration is looking for the MyStuff.Sitecore.Tasks.UpdateJob type should be able to find it. Also, i've checked in the Sitecore logs and i don't see any error or anything regarding the task

any idea what i'm missing?


Edit the only thing "suspicious" that i'm seeing in the logs is:

ManagedPoolThread #12 15:53:10 INFO  Starting update of index for the database 'master' (1 pending).
ManagedPoolThread #12 15:53:10 INFO  Update of index for the database 'master' done.
ManagedPoolThread #18 15:53:36 ERROR Exception in geoip worker thread.
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType)
   at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature, RuntimeType declaringType)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
   at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.Factory.GetProviders[TProvider,TCollection](List`1 nodes)
   at Sitecore.Configuration.Factory.GetProviders[TProvider,TCollection](String rootPath, TProvider& defaultProvider)
   at Sitecore.Configuration.ProviderHelper`2.ReadProviders()
   at Sitecore.Configuration.ProviderHelper`2.get_Provider()
   at Sitecore.Analytics.Lookups.GeoIpWorker.ProcessGeoIp()
   at Sitecore.Analytics.Lookups.GeoIpWorker.<Wakeup>b__3(Object a)

I'm using Sitecore 6.5

3

3 Answers

3
votes

Can you try updating your agent declaration to <agent type="Mystuff.Sitecore.Tasks.UpdateJob, Mystuff" method="Run" interval="00:00:05"> where the Mystuff is your assembly name. Seems like the assembly is missing.

Added as answer based on techphoria414's suggestion.

0
votes

Although I'm side-stepping your question a bit, I have never been successful with getting the debugger to be called while working on scheduled tasks. I instead used Sitecore.Diagnostics.Log and then the related debug level I'm looking to display. Often times I found this rather limiting, but with a third-party tail utility you can watch the log rather easily as it happens.

Maybe this will give you an interm solution until someone else answers.

0
votes

The answer lies in <frequency>00:00:10</frequency>, this should always be as low as your most frequent task, so in this case 00:00:05.