API job status out of sync - VisualCron - Forum

Community forum

bbbb
  •  bbbb
  • No customer Topic Starter
2013-06-19T16:52:51Z
We are using the API to check the status of a job. However sometimes the job status reported via API is stale (i.e. "Running") when in fact the job is idle (as reported through VC Client).

Is there an API function to force a refresh to the JobClass object? Any ideas why this would occur?


var conn = new VisualCronAPI.Connection();
var vcServer = vcClient.Connect(conn, true);
var myJob = vcServer.Jobs.Get("test");

if(myJob.Stats.Active && myJob.Stats.Status == VisualCron.JobStatsClass.StatusT.Waiting) {
    //run job
}
Support
2013-06-20T09:04:33Z
Not sure why this happens for you but you can debug this by adding a handler for event:

Jobs.JobStatsUpdatedStatic

If you subscribe to this even you can log each time status changes and maybe that can provide some more insight.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bbbb
  •  bbbb
  • No customer Topic Starter
2013-06-20T16:37:17Z
In the VisualCron Client, how often do you get the VisualCron.JobClass from the server? In my application, during the initialization, I call "vcServer.Jobs.Get(..)" one time and hold the reference to object throughout life cycle of service.

Would calling Jobs.Get(...) every time help refresh the JobClass.Stats in the JobClass object?
Support
2013-06-24T12:36:53Z
We refresh the object when we receive Job updates (status or whole updates).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Users browsing this topic
Scroll to Top