Merge pull request #4213 from fahedouch/remove_unnecessary_condition

remove if condition because it is handled by the sdNotify daemon func
This commit is contained in:
Phil Estes 2020-04-27 10:57:56 -04:00 committed by GitHub
commit 3f95bc5f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ package command
import ( import (
"context" "context"
"os"
sd "github.com/coreos/go-systemd/v22/daemon" sd "github.com/coreos/go-systemd/v22/daemon"
@ -38,15 +37,11 @@ func notifyStopping(ctx context.Context) error {
} }
func sdNotify(ctx context.Context, state string) error { func sdNotify(ctx context.Context, state string) error {
if os.Getenv("NOTIFY_SOCKET") != "" { notified, err := sd.SdNotify(false, state)
notified, err := sd.SdNotify(false, state) log.G(ctx).
log.G(ctx). WithError(err).
WithError(err). WithField("notified", notified).
WithField("notified", notified). WithField("state", state).
WithField("state", state). Debug("sd notification")
Debug("sd notification") return err
return err
}
return nil
} }