f-79: agent: section times, renvoi de system_powerdown, attentes #79

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-25 12:42:10 +01:00
commit 8e89865418
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
13 changed files with 602 additions and 80 deletions

View file

@ -0,0 +1,26 @@
package dispatcher
import (
"errors"
"time"
)
var errWaitTimeout = errors.New("timed out")
func waitUntil(timeout, poll time.Duration, done func() (bool, error)) error {
deadline := time.After(timeout)
for {
ok, err := done()
if err != nil {
return err
}
if ok {
return nil
}
select {
case <-deadline:
return errWaitTimeout
case <-time.After(poll):
}
}
}