Optimizer: fix update logic (#24862)
This commit is contained in:
parent
c2cae902cd
commit
6dea5ed21e
1 changed files with 4 additions and 4 deletions
|
|
@ -54,6 +54,10 @@ type responseDetails struct {
|
|||
func (site *Site) optimizerUpdateAsync(battery []measurement) {
|
||||
var err error
|
||||
|
||||
if time.Since(updated) < 2*time.Minute {
|
||||
return
|
||||
}
|
||||
|
||||
if !mu.CompareAndSwap(0, 1) {
|
||||
return
|
||||
}
|
||||
|
|
@ -71,10 +75,6 @@ func (site *Site) optimizerUpdateAsync(battery []measurement) {
|
|||
}
|
||||
}()
|
||||
|
||||
if time.Since(updated) < 2*time.Minute {
|
||||
return
|
||||
}
|
||||
|
||||
err = site.optimizerUpdate(battery)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue