Skip to content

Commit e5efac0

Browse files
committed
fix: move stop signal to proper place
1 parent 27e4835 commit e5efac0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stream/stream.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,6 @@ func (s *stream) Close(closeWithCancel bool) {
388388
disableStreamEndByClient := s.version.Lower(couchbase.SrvVer550)
389389
s.closeAllStreams(disableStreamEndByClient)
390390

391-
if !s.streamFinishedWithEndEventCh {
392-
s.finishStreamWithCloseCh <- struct{}{}
393-
}
394-
395391
s.observers.Range(func(_ uint16, observer couchbase.Observer) bool {
396392
observer.CloseEnd()
397393
return true
@@ -404,6 +400,10 @@ func (s *stream) Close(closeWithCancel bool) {
404400
logger.Log.Info("stream stopped")
405401
s.eventHandler.AfterStreamStop()
406402
s.open = false
403+
404+
if !s.streamFinishedWithEndEventCh {
405+
s.finishStreamWithCloseCh <- struct{}{}
406+
}
407407
}
408408

409409
func (s *stream) GetOffsets() (*wrapper.ConcurrentSwissMap[uint16, *models.Offset], *wrapper.ConcurrentSwissMap[uint16, bool], bool) {

0 commit comments

Comments
 (0)