From 2f6434dd0c93a0196d5a8a51f9e381014a928fdb Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Wed, 19 May 2021 11:09:59 -0400 Subject: [PATCH] try again on EAGAIN from dbus Signed-off-by: Peter Hunt --- utils/utils.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index cfb2788edc1..9bc6b8e5de6 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -69,9 +69,14 @@ func RunUnderSystemdScope(pid int, slice, unitName string, properties ...systemd properties = append(properties, systemdDbus.PropSlice(slice)) } ch := make(chan string) - _, err = conn.StartTransientUnitContext(ctx, unitName, "replace", properties, ch) - if err != nil { - return err + for { + _, err = conn.StartTransientUnitContext(ctx, unitName, "replace", properties, ch) + if err == nil { + break + } + if !errors.Is(err, syscall.EAGAIN) { + return err + } } defer conn.Close()