question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rescheduling timer is going crazy

See original GitHub issue

Greetings, Ralf! I use Nougat device to test exact job (i need just alarm manager fashioned behavior) The problem occurs when i return Job.Result.RESCHEDULE in my onRunJob(). Looks like the lib trying to reschedule the failed job with startMs +backoffMs (which is backoffMs * mNumFailures in fact) delay. So for example if i schedule the task on +5 hours, the next rescheduled task will trigger in 10 hours + some backoff millis. Which is wrong in my opinion. The rescheduling time should be something like currentTime + currentBackoffMs

I suppose the reason is this piece from com.evernote.android.job.JobProxy.Common#getStartMs:

 public static long getStartMs(JobRequest request) {
            return checkedAdd(request.getStartMs(), request.getBackoffOffset());
        }

Will appreciate any advices.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
vRallevcommented, Jan 25, 2017

The behavior has slightly changed. Previously when a job was rescheduled the start and end window increased by the corresponding back-off criteria.

Imagine this job:

new JobRequest.Builder(DemoSyncJob.TAG)
        .setExecutionWindow(3_000L, 4_000L)
        .setBackoffCriteria(5_000L, JobRequest.BackoffPolicy.LINEAR)
        .build();

When this job was rescheduled for the first time, then the execution window changed to (8_000, 9_000), 2nd fail (13_000, 14_000), …

Now it has changed in that way, that the start and end window aren’t added to the back-off criteria anymore. First fail (5_000, 5_000), 2nd fail (10_000, 10_000), …

Is this helpful?

1reaction
vRallevcommented, Jan 25, 2017

Fixed in version 1.1.5. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rescheduling a Timer Task (Java in General ... - CodeRanch
No. You have to cancel and then reschedule it. I was asking about canceling a running job, i.e. interrupting its execution, which would...
Read more >
TimerTask runs one more time after I call timer.cancel() method
The cancel method will stop all following executions, but not the current one. It your method execution takes a long time, ...
Read more >
Timer DSL rule reschedule if state - openHAB Community
Hi, I'm using the DSL rule of this tutorial: Design Pattern: Motion Sensor Timer The problem I'm facing is that sometimes, there is...
Read more >
Windows Timer Resolution: The Great Rule Change
Here's the crazy thing: timeBeginPeriod can be called by any program and it changes the timer interrupt interval, and the timer interrupt is ......
Read more >
window.setTimeout() goes crazy periodically - Bugzilla@Mozilla
setTimeout() goes crazy periodically - functions are immediately called ... testcase showing timer get called too quickly ... Reschedule the OS timer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found