Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/core/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ func (e *Executor) Dump(ctx context.Context, opts DumpOptions) (DumpResults, err
uploadSpan.SetStatus(codes.Ok, "completed")
uploadSpan.End()

logger.Infof("finished dump %s", now.Format(time.RFC3339))

return results, nil
}

Expand Down
15 changes: 9 additions & 6 deletions pkg/core/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ type Update struct {
// Last whether or not this is the last update, and no more will be coming.
// If true, perform this action and then end.
Last bool
// Next time until the next update, if applicable.
Next time.Duration
}

func sendTimer(c chan Update, last bool) {
func sendTimer(c chan Update, last bool, next time.Duration) {
// make the channel write non-blocking
select {
case c <- Update{Last: last}:
case c <- Update{Last: last, Next: next}:
default:
}
}
Expand Down Expand Up @@ -66,17 +68,14 @@ func Timer(opts TimerOptions) (<-chan Update, error) {

// if once, ignore all delays and go
if opts.Once {
sendTimer(c, true)
sendTimer(c, true, 0)
return
}

// create our delay and timer loop and go
for {
lastRun := time.Now().UTC()

// not once - run the first backup
sendTimer(c, false)

if opts.Cron != "" {
now := time.Now().UTC()
delay, _ = waitForCron(opts.Cron, now)
Expand All @@ -95,6 +94,9 @@ func Timer(opts TimerOptions) (<-chan Update, error) {
delay = time.Duration(opts.Frequency-passed) * time.Minute
}

// not once - run the first backup
sendTimer(c, false, delay)

// if delayMins is 0, this will do nothing, so it does not hurt
time.Sleep(delay)
}
Expand Down Expand Up @@ -178,6 +180,7 @@ func (e *Executor) Timer(timerOpts TimerOptions, cmd func() error) error {
if update.Last {
break
}
e.Logger.Infof("next run in %s", update.Next.String())
}
return nil
}