Site: add random delay before requesting meters (#19746)
This commit is contained in:
parent
3d89080858
commit
c2f31f1456
1 changed files with 4 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand/v2"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
|
@ -481,6 +482,9 @@ func (site *Site) collectMeters(key string, meters []config.Device[api.Meter]) [
|
|||
mm := make([]measurement, len(meters))
|
||||
|
||||
fun := func(i int, dev config.Device[api.Meter]) {
|
||||
// decouple potential double-connects on modbus
|
||||
time.Sleep(time.Duration(rand.Uint64N(uint64(100 * time.Millisecond))))
|
||||
|
||||
meter := dev.Instance()
|
||||
|
||||
// power
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue