Skip to content

Commit

Permalink
Merge pull request #5 from me2go/master
Browse files Browse the repository at this point in the history
Remove topic
  • Loading branch information
vardius authored Jun 30, 2020
2 parents 6f31ddd + 9e981f1 commit 48159e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ func (b *messageBus) Unsubscribe(topic string, fn interface{}) error {
if h.callback == rv {
close(h.queue)

b.handlers[topic] = append(b.handlers[topic][:i], b.handlers[topic][i+1:]...)
if len(b.handlers[topic]) == 1 {
delete(b.handlers, topic)
} else {
b.handlers[topic] = append(b.handlers[topic][:i], b.handlers[topic][i+1:]...)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/vardius/message-bus
module github.com/me2go/message-bus

go 1.12

0 comments on commit 48159e4

Please sign in to comment.