Problem with scheduled job running too many times

I have gone through the code and the job is only scheduled once and after the first day checked in upcoming jobs and it was only there once,

Everytime it is rescheduled there is a unschedule call. so this should not be possible but it was running numberous times when it fired..

Not sure what is going on , but i now have done a soft reset and restore to see if it fixes the issue.

the other vehicle is disabled and i only leave in as a placeholder in the rules in case the device gets deleted and recreated so i dont have to totaly redo the rules.

any ideas what could be going on. other that the obvious corruption of the database..

@bobbyD

I might suggest posting the full code--or, even better, a minimal example that demonstrates the problem (almost always, when people try to create one of these, they discover whatever thr problem actually was and are able to fix it themselves). It's not clear to me which job you are referring to, but looking at thr log entries that I assume are supposed to demonstrate the problem, I don't see any method that runs and generates those entries, so I assume something is missing.

Also, I recall someone asking a similar question a while back and got a couple ideas there. I'd also suggest lookimg that thread and making sure it's not the same thing. The logs make it seem like it could be. :slight_smile:

EDIT: found it! (Thought this might have been your question too, but it's not. But looks like the same issue, likely.)

2 Likes

i posted the pictdure showing the search for the method. reenable in yellow.. you can see from the pictures it is only in the code once.. easier than trying to post hundeds of lines of code

could be thanks.. i'll make sure to add seconds to the time string.. that could be the case.. thanks

One more reason a minimal example is even better than the full thing, then. :slight_smile:

Take a look at the thread I linked to above. I'm guessing you might be doing something similar in your code. I didn't have this link handy at the time I originally posted that reply.

Thanks the problem was the reschedule at the same time it was running.. so that it would immediately run again.. i will add a pause brefore rescheduling.. because just like the other case it was rescheduing the same minute it was running.. that is the real issue.. thanks again.

Yeah, the idea is that if it's 9:04 AM and you're running a cron job at that the that is, itself, (re)scheduling the same thing for 9:04 AM as part of its execution, it may run multiple times until the scheduler no longer thinks it should run. (I don't know the details of how Quartz, the scheduler here, works in these specific cases--like if you say 9:04 if it only means the top of the minute or any time during that minute, but both this behavior and the one in that thread sounds like it must be the latter.)

Glad you got it figured out!

PS - Not related to your problem, but FYI, width: on an input in a driver does not have any affect. :smiley: This only applies to apps, where you have some control over the interface.

1 Like

weird i would have thought it would work because there is an input string for date time showing in the device panel how is that different than an app?

The driver just lays out the preferences for you, all some predetermined width. Try it with and without to see. :slight_smile: