Skip to content

Commit

Permalink
source-firestore: fix hanging connector on streamChanges error
Browse files Browse the repository at this point in the history
When an error occurs in StreamChanges, we had previously failed to call `Done`
on the `streamsInCatchup` `WaitGroup`.  This resulted in the connector hanging
indefinitely and refusing to exit. This is a quick and dirty fix to hopefully
fix the most acute issues.
  • Loading branch information
psFried committed Mar 4, 2024
1 parent 07e669a commit 3e7fe2f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source-firestore/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,13 @@ func (c *capture) StreamChanges(ctx context.Context, client *firestore_v1.Client
if !catchupStreaming {
catchupStreaming = true
c.streamsInCatchup.Add(1)

// Ensure that we call Done if there's an early return
defer func() {
if catchupStreaming {
c.streamsInCatchup.Done()
}
}()
}
catchupStarted = time.Now()
}
Expand Down

0 comments on commit 3e7fe2f

Please sign in to comment.