Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pubsub.go #306

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/ThreeDotsLabs/watermill
module github.com/golang-boy/watermill
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
module github.com/golang-boy/watermill
module github.com/ThreeDotsLabs/watermill


go 1.17

Expand Down
5 changes: 3 additions & 2 deletions pubsub/gochannel/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ func (g *GoChannel) sendMessage(topic string, message *message.Message) (<-chan

if len(subscribers) == 0 {
close(ackedBySubscribers)
g.logger.Info("No subscribers to send message", logFields)
return ackedBySubscribers, nil
err := errors.New("No subscribers")
g.logger.Error("No subscribers to send message", err, logFields)
return ackedBySubscribers, err
Comment on lines +145 to +147
Copy link
Member

Choose a reason for hiding this comment

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

There's no error by design, as Publish drops the message if no subscribers are waiting for it. If you'd like to see an error in this case, we would need a configuration option not to change the current behavior.

}

go func(subscribers []*subscriber) {
Expand Down