remove unnecessary check from throttle check

This commit is contained in:
Sam Lewis
2022-10-17 12:32:26 -04:00
parent 2c5e68903a
commit b92147a6a6
2 changed files with 13 additions and 20 deletions

View File

@@ -178,9 +178,8 @@ func callEntityListeners(app *app, msgBytes []byte) {
}
// don't run callback if Throttle is set and that duration hasn't passed since lastRan
if l.throttle.Seconds() > 0 && // throttle is set
!l.lastRan.Eq(carbon.Now().StartOfCentury()) && // lastRan is set aka this callback has been called since starting gomeassistant
l.lastRan.DiffAbsInSeconds(carbon.Now()) < int64(l.throttle.Seconds()) { // it's been less than <throttle> seconds since it last ran
if l.throttle.Seconds() > 0 &&
l.lastRan.DiffAbsInSeconds(carbon.Now()) < int64(l.throttle.Seconds()) {
return
}