Skip to content

Commit

Permalink
fix: stop iteration on context cancellation
Browse files Browse the repository at this point in the history
fixes #4330
  • Loading branch information
stuartwdouglas committed Feb 7, 2025
1 parent 8c68e45 commit 87d847f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 8 additions & 10 deletions examples/go/echo/types.ftl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion internal/raft/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,12 @@ func (s *ShardHandle[Q, R, E]) StateIter(ctx context.Context, query Q) (iter.Seq

for {
select {
case <-ctx.Done():
close(result)
return
case <-s.cluster.runningCtx.Done():
logger.Infof("Changes channel closed")
close(result)

return
case <-timer.C:
last, err := s.getLastIndex()
Expand Down

0 comments on commit 87d847f

Please sign in to comment.