Site: add random delay before requesting meters (#19746)

This commit is contained in:
andig 2025-03-13 11:10:37 +01:00 • committed by GitHub
parent 3d89080858
commit c2f31f1456
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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