Skip to content

Conversation

tymonx
Copy link

@tymonx tymonx commented Apr 12, 2022

The go-chi router overrides added handlers for the same route.

It fixes ThreeDotsLabs/watermill#280

The go-chi router overrides added handlers for the same route.
@tymonx tymonx changed the title Fix multi subscribe handling for single topic Fix multi subscribes handling for the same single topic Apr 12, 2022
@@ -104,7 +104,8 @@ func (s *Subscriber) Subscribe(ctx context.Context, url string) (<-chan *message
messages := make(chan *message.Message)

s.outputChannelsLock.Lock()
s.outputChannels = append(s.outputChannels, messages)
s.outputChannels[url] = append(s.outputChannels[url], messages)
channels := s.outputChannels[url]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's fine to call s.config.Router.Post below for each Subscribe separately. Perhaps it should be cached in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[watermill-http] It doesn't support multi subscribes for the same single topic
2 participants