Skip to content

Commit

Permalink
Bug 581339: Handle negative job delay
Browse files Browse the repository at this point in the history
Negative delay indicates job is not scheduled. Setting it to 0, caused immediate unintentional job rescheduling.
  • Loading branch information
basilevs committed Apr 28, 2023
1 parent 291c11a commit 8b471e9
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.rcptt.tesla.jobs;

import java.lang.Math;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -47,9 +48,11 @@ public synchronized static JobsManager getInstance() {
}

public synchronized long calculateNewTime(InternalJob job, long time) {
if (toNullifyTime.contains(job)) {
toNullifyTime.remove(job);
return 0;
if (toNullifyTime.remove(job)) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=581339
// Can't return just 0, as sign matters for rescheduling logic
// see org.eclipse.core.internal.jobs.InternalJob.startTime
return Math.min(0, time);
}
return time;
}
Expand Down

0 comments on commit 8b471e9

Please sign in to comment.