Skip to content

Commit

Permalink
chore: added extra logs before sleeping after db cmd (#4671)
Browse files Browse the repository at this point in the history
  • Loading branch information
istae authored May 13, 2024
1 parent ffc1aef commit 485ec6c
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions cmd/bee/cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ func dbCompactCmd(cmd *cobra.Command) {
if err != nil {
logger.Error(err, "getting sleep value failed")
}
defer func() { time.Sleep(d) }()
defer func() {
if d > 0 {
logger.Info("command has finished, sleeping...", "duration", d.String())
time.Sleep(d)
}
}()

dataDir, err := cmd.Flags().GetString(optionNameDataDir)
if err != nil {
Expand Down Expand Up @@ -266,7 +271,12 @@ func dbRepairReserve(cmd *cobra.Command) {
if err != nil {
logger.Error(err, "getting sleep value failed")
}
defer func() { time.Sleep(d) }()
defer func() {
if d > 0 {
logger.Info("command has finished, sleeping...", "duration", d.String())
time.Sleep(d)
}
}()

db, err := storer.New(cmd.Context(), path.Join(dataDir, "localstore"), &storer.Options{
Logger: logger,
Expand Down Expand Up @@ -781,6 +791,12 @@ func dbNukeCmd(cmd *cobra.Command) {
if err != nil {
logger.Error(err, "getting sleep value failed")
}
defer func() {
if d > 0 {
logger.Info("command has finished, sleeping...", "duration", d.String())
time.Sleep(d)
}
}()

dataDir, err := cmd.Flags().GetString(optionNameDataDir)
if err != nil {
Expand Down Expand Up @@ -850,10 +866,6 @@ func dbNukeCmd(cmd *cobra.Command) {
}
}

logger.Info("nuke finished")

time.Sleep(d)

return nil
}}
c.Flags().String(optionNameDataDir, "", "data directory")
Expand Down

0 comments on commit 485ec6c

Please sign in to comment.