Skip to content

Commit

Permalink
o365audit: Make delays cancellation-friendly
Browse files Browse the repository at this point in the history
PR elastic#21258 introduced a restart mechanism for o365input so that it didn't
stop working once a fatal error was found. This updates the restart delay to
use a cancellation-context-aware method so that the input doesn't block
Filebeat termination.
  • Loading branch information
adriansr committed Oct 7, 2020
1 parent 3e86c2a commit b51d2fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion x-pack/filebeat/input/o365audit/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/elastic/beats/v7/libbeat/logp"
"github.com/elastic/beats/v7/x-pack/filebeat/input/o365audit/poll"
"github.com/elastic/go-concert/ctxtool"
"github.com/elastic/go-concert/timed"
)

const (
Expand Down Expand Up @@ -127,7 +128,7 @@ func (inp *o365input) Run(
publisher.Publish(event, nil)
ctx.Logger.Errorf("Input failed: %v", err)
ctx.Logger.Infof("Restarting in %v", failureRetryInterval)
time.Sleep(failureRetryInterval)
timed.Wait(ctx.Cancelation, failureRetryInterval)
}
}
return nil
Expand Down

0 comments on commit b51d2fe

Please sign in to comment.