Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce logger noise #1011

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Changes from 1 commit
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
23 changes: 18 additions & 5 deletions autopilot/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ func (ap *Autopilot) Run() error {
var forceScan bool
var launchAccountRefillsOnce sync.Once
for {
// check for shutdown right before starting a new iteration
select {
case <-ap.shutdownCtx.Done():
peterjan marked this conversation as resolved.
Show resolved Hide resolved
return nil
default:
}

ap.logger.Info("autopilot iteration starting")
tickerFired := make(chan struct{})
ap.workers.withWorker(func(w Worker) {
Expand All @@ -220,7 +227,7 @@ func (ap *Autopilot) Run() error {
close(tickerFired)
return
}
ap.logger.Error("autopilot stopped before consensus was synced")
ap.logger.Info("autopilot stopped before consensus was synced")
return
} else if blocked {
if scanning, _ := ap.s.Status(); !scanning {
Expand All @@ -234,7 +241,7 @@ func (ap *Autopilot) Run() error {
close(tickerFired)
return
}
ap.logger.Error("autopilot stopped before it was able to confirm it was configured in the bus")
ap.logger.Info("autopilot stopped before it was able to confirm it was configured in the bus")
return
}

Expand Down Expand Up @@ -463,11 +470,17 @@ func (ap *Autopilot) blockUntilSynced(interrupt <-chan time.Time) (synced, block
}

func (ap *Autopilot) tryScheduleTriggerWhenFunded() error {
ctx, cancel := context.WithTimeout(ap.shutdownCtx, 30*time.Second)
wallet, err := ap.bus.Wallet(ctx)
cancel()
// no need to schedule a trigger if we're stopped
if ap.isStopped() {
peterjan marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

// apply sane timeout
ctx, cancel := context.WithTimeout(ap.shutdownCtx, time.Minute)
defer cancel()

// no need to schedule a trigger if the wallet is already funded
wallet, err := ap.bus.Wallet(ctx)
if err != nil {
return err
} else if !wallet.Confirmed.Add(wallet.Unconfirmed).IsZero() {
Expand Down
Loading