Bugfix: wrong next request time detection
This commit is contained in:
@@ -162,8 +162,13 @@ public class Client {
|
|||||||
// wait
|
// wait
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
this.gui.status(String.format("Waiting until %tR before requesting job", next_request));
|
this.gui.status(String.format("Waiting until %tR before requesting job", next_request));
|
||||||
|
long wait = next_request.getTimeInMillis() - now.getTime();
|
||||||
|
if (wait < 0) {
|
||||||
|
// it means the client has to wait until the next day
|
||||||
|
wait += 24*3600*1000;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(next_request.getTimeInMillis() - now.getTime());
|
Thread.sleep(wait);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e3) {
|
catch (InterruptedException e3) {
|
||||||
|
|
||||||
@@ -551,16 +556,9 @@ public class Client {
|
|||||||
if (start.before(now) && now.before(end)) {
|
if (start.before(now) && now.before(end)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (start.after(now)) {
|
if (next == null || (start.before(next) && start.after(now))) {
|
||||||
if (next == null) {
|
|
||||||
next = start;
|
next = start;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (start.before(next)) {
|
|
||||||
next = start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
|
|||||||
Reference in New Issue
Block a user