Skip to content

Commit

Permalink
Recreate subscription if failing to read events
Browse files Browse the repository at this point in the history
  • Loading branch information
kuiperda committed Sep 13, 2024
1 parent da20290 commit f809b1a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/stanza/operator/input/windows/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,13 @@ func (i *Input) read(ctx context.Context) int {
events, err := i.subscription.Read(i.maxReads)
if err != nil {
i.Logger().Error("Failed to read events from subscription", zap.Error(err))
i.subscription.Close()
closeErr := i.subscription.Close()
if closeErr != nil {
i.Logger().Error("Failed to close subscription", zap.Error(closeErr))
return 0
}
i.Logger().Info("Recreating subscription")
i.subscription = NewRemoteSubscription(i.remote.Server)
i.Logger().Info("Reopening subscription")
return 0
}

Expand Down

0 comments on commit f809b1a

Please sign in to comment.