Skip to content

Commit

Permalink
fix: Disable multiple subscription to the same topic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronosXYZ committed Sep 13, 2019
1 parent fbb2b84 commit 185ef48
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ func SubscribeToTopic(topic string) {
log.Println("Manual subscription to service topic is not allowed!")
return
}
if _, ok := subscribedTopics[topic]; ok {
log.Println("You are already subscribed to the topic!")
return
}
incomingMessages := make(chan pubsub.Message)
subscription, err := Pb.Subscribe(topic)
if err != nil {
Expand Down

0 comments on commit 185ef48

Please sign in to comment.