fix: daemon don't leaveHost when keepStorage=true
@@ -766,11 +766,13 @@ func (cd *clientDaemon) Stop() {
cd.once.Do(func() {
close(cd.done)
if cd.schedulerClient != nil {
+ if !cd.Option.KeepStorage {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
if err := cd.schedulerClient.LeaveHost(ctx, &schedulerv1.LeaveHostRequest{Id: cd.schedPeerHost.Id}); err != nil {
logger.Errorf("daemon leaveHost error: %s", err.Error())
}
+ }
if err := cd.schedulerClient.Close(); err != nil {
logger.Errorf("scheduler client failed to stop: %s", err.Error())
} else {
