Skip to content

Commit

Permalink
close subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
kuiperda committed Sep 13, 2024
1 parent c8b716d commit da20290
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/stanza/operator/input/windows/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,10 @@ func (i *Input) readToEnd(ctx context.Context) {
default:
if count := i.read(ctx); count == 0 {
if i.isRemote() {
i.Logger().Info("Stopping remote session", zap.String("server", i.remote.Server))
if err := i.stopRemoteSession(); err != nil {
i.Logger().Error("Failed to stop remote session", zap.String("server", i.remote.Server), zap.Error(err))
return
}
i.Logger().Info("Start remote session", zap.String("server", i.remote.Server))
if err := i.startRemoteSession(); err != nil {
i.Logger().Error("Failed to re-establish remote session", zap.String("server", i.remote.Server), zap.Error(err))
return
}
i.Logger().Info("Open")
if err := i.subscription.Open(i.startAt, uintptr(i.remoteSessionHandle), i.channel, i.bookmark); err != nil {
i.Logger().Error("Failed to re-open subscription for remote server", zap.String("server", i.remote.Server), zap.Error(err))
}
Expand All @@ -223,6 +216,9 @@ 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()
i.subscription = NewRemoteSubscription(i.remote.Server)
i.Logger().Info("Reopening subscription")
return 0
}

Expand Down

0 comments on commit da20290

Please sign in to comment.