Skip to content

Commit

Permalink
chore: Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Nov 11, 2023
1 parent 9cf3688 commit 1cb4e2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ L:
agent.rec.Add(dps)
dps = dps[:0]
default:
// Nothing to do
// nothing to do
}

q, err := agent.data.Next()
Expand Down
10 changes: 5 additions & 5 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,25 @@ func (task *Task) Run() (*Report, error) {
ctx, cancel = context.WithTimeout(ctx, task.Time)
}

// Trap SIGINT
// trap SIGINT
{
sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt)

go func() {
select {
case <-ctx.Done():
// Nothing to do
// nothing to do
case <-sigint:
// Stop query on interrupt
// stop query on interrupt
cancel()
eg.Wait() //nolint:errcheck
os.Exit(130)
}
}()
}

// Timeout
// timeout
if task.Time > 0 {
go func() {
<-ctx.Done()
Expand All @@ -119,7 +119,7 @@ func (task *Task) Run() (*Report, error) {
progress.Start(ctx, rec)
err = eg.Wait()
cancel()
rec.Close() // Wait for buffer flush
rec.Close() // wait for buffer flush

if err != nil && !errors.Is(err, context.DeadlineExceeded) {
return nil, err
Expand Down

0 comments on commit 1cb4e2a

Please sign in to comment.