Changed cron trigger to reset when majority of minute is over
This commit is contained in:
parent
f0137b2161
commit
5a222ba051
1 changed files with 3 additions and 2 deletions
|
|
@ -39,7 +39,8 @@ public class DateTimeTrigger implements HalTrigger,Configurator.PostConfiguratio
|
||||||
public boolean evaluate() {
|
public boolean evaluate() {
|
||||||
if (cronTimer == null)
|
if (cronTimer == null)
|
||||||
return false;
|
return false;
|
||||||
if (System.currentTimeMillis()-timeOut > 60*1000) // have we passed the timeout by one minute?
|
// have we passed the majority of the minute? then get next timeout
|
||||||
|
if (System.currentTimeMillis()-timeOut > 50*1000)
|
||||||
reset();
|
reset();
|
||||||
return timeOut <= System.currentTimeMillis();
|
return timeOut <= System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +48,7 @@ public class DateTimeTrigger implements HalTrigger,Configurator.PostConfiguratio
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
if (cronTimer != null)
|
if (cronTimer != null)
|
||||||
timeOut = cronTimer.next(System.currentTimeMillis() - 60*1000); // include this
|
timeOut = cronTimer.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(){
|
public String toString(){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue