Dean, that worked like a charm; thanks again.
On Mon, May 6, 2013 at 1:14 PM, Dean Yu <[email protected]> wrote: > I think you're on the right track. I think that you do need to save off > the new instance in getNewInstance(), so that when the user reconfigures, > you can call cancel() on it to cancel the pending run. Then, instead of > calling doAperiodicRun(), call doRun() which is inherited from > AperiodicWork. This calls doAperiodicRun() and then sets up the new > schedule. You don't need to create the new instance yourself. > > -- Dean > > > On Monday, May 6, 2013 10:36:51 AM UTC-7, Marc MacIntyre wrote: >> >> I've got a subclass of AsyncAperiodicWork firing off a task periodically, >> at an interval that can be updated and configured by the user in the config. >> >> When the user updates the config, I am immediately scheduling a new run >> of the task by instantiating a new instance and calling doAperiodicRun() on >> it. >> >> However, when I do that, the next scheduled run doesn't happen until the >> previously configured recurrenceInterval has gone by (and the new interval >> doesn't take effect until that happens, too). >> >> For example: >> at startup, recurrence of 10 minutes. >> >> at 1 minute, reconfigure for recurrence of 1 minute >> call doAperiodicRun() >> >> Next occurrence of the task doesn't come until t=10minutes >> >> Then every minute afterward the task fires >> >> I tried a possible workaround, which was to grab the instance created in >> getNewInstance() and store it in a class variable, and call >> doAperiodicRun() on that when attempting to reschedule, but it didn't >> change the behavior (and feels pretty dangerous, anyway). >> >> Is there something I'm supposed to be doing to force a reschedule of the >> pending runs, or is this a bug? >> >> -- >> Marc MacIntyre >> > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Marc MacIntyre -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
