refresh-data - make guard condition better readable
This commit is contained in:
parent
f680d70548
commit
785e1b323c
|
@ -323,9 +323,10 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!reason.toLowerCase().contains("user")
|
||||
&& lastCmdTime.getTime() > 0
|
||||
&& System.currentTimeMillis() < lastCmdTime.getTime() + 60 * 1000) {
|
||||
boolean notAUserRequest = !reason.toLowerCase().contains("user");
|
||||
boolean wasRunAtLeastOnce = lastCmdTime.getTime() > 0;
|
||||
boolean ranWithinTheLastMinute = System.currentTimeMillis() < lastCmdTime.getTime() + 60 * 1000;
|
||||
if (notAUserRequest && wasRunAtLeastOnce && ranWithinTheLastMinute) {
|
||||
log.debug("Not fetching state from pump, since we did already within the last 60 seconds");
|
||||
} else {
|
||||
runCommand(new ReadPumpStateCommand());
|
||||
|
|
Loading…
Reference in a new issue