Skip to content

Commit

Permalink
Do not try to create and then set node in dcs (Set already handles th…
Browse files Browse the repository at this point in the history
…is) (#109)
  • Loading branch information
secwall authored Jun 11, 2024
1 parent bc9b606 commit 77f1af9
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions internal/app/app_dcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ func (app *App) setResetupStatus(host string, status bool) error {
Status: status,
UpdateTime: time.Now(),
}
err = app.dcs.Create(dcs.JoinPath(pathResetupStatus, host), resetupStatus)
if err != nil && err != dcs.ErrExists {
return err
}
err = app.dcs.Set(dcs.JoinPath(pathResetupStatus, host), resetupStatus)
if err != nil {
return err
Expand All @@ -113,11 +109,7 @@ func (app *App) GetResetupStatus(host string) (mysql.ResetupStatus, error) {
}

func (app *App) UpdateLastShutdownNodeTime() error {
err := app.dcs.Create(pathLastShutdownNodeTime, time.Now())
if err != nil && err != dcs.ErrExists {
return err
}
err = app.dcs.Set(pathLastShutdownNodeTime, time.Now())
err := app.dcs.Set(pathLastShutdownNodeTime, time.Now())
if err != nil {
return err
}
Expand Down

0 comments on commit 77f1af9

Please sign in to comment.