From 9ea0dae308c3001c323f2331c72decdc643d7ddd Mon Sep 17 00:00:00 2001 From: Piotr Piotrowski Date: Thu, 25 Jul 2024 11:30:51 +0200 Subject: [PATCH] Fixed issues after resolving conflicts Signed-off-by: Piotr Piotrowski --- jetstream/ordered.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jetstream/ordered.go b/jetstream/ordered.go index b9a935d5b..85b7ea9e9 100644 --- a/jetstream/ordered.go +++ b/jetstream/ordered.go @@ -181,9 +181,9 @@ func (c *orderedConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt case <-sub.done: s := sub.consumer.currentSub if s != nil { - s.consumer.Lock() + sub.consumer.Lock() s.Stop() - s.consumer.Unlock() + sub.consumer.Unlock() } return case msgsLeft, ok := <-c.stopAfterMsgsLeft: @@ -334,10 +334,10 @@ func (s *orderedSubscription) Stop() { if !atomic.CompareAndSwapUint32(&s.closed, 0, 1) { return } + s.consumer.Lock() + defer s.consumer.Unlock() if s.consumer.currentSub != nil { - s.consumer.currentConsumer.Lock() s.consumer.currentSub.Stop() - s.consumer.currentConsumer.Unlock() } close(s.done) }