Skip to content

Commit

Permalink
Cancel delta stream on delta send (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
anjmao authored Mar 6, 2024
1 parent 2a6e399 commit 80c13ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/controller/state/delta/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ func (c *Controller) sendDeltas(ctx context.Context, firstDeltaReport bool) {
return
}

// Cancel context to close stream after deltas are sent.
ctx, cancel := context.WithCancel(ctx)
defer cancel()

if firstDeltaReport {
ctx = metadata.AppendToOutgoingContext(ctx,
"x-delta-full-snapshot", "true",
)
}
deltaStream, err := c.castaiClient.KubernetesDeltaIngest(ctx, grpc.UseCompressor(gzip.Name))
if err != nil {
if err != nil && !errors.Is(err, context.Canceled) {
c.log.Warnf("creating delta upload stream: %v", err)
return
}
Expand Down

0 comments on commit 80c13ad

Please sign in to comment.