Skip to content

Commit ed3e5cb

Browse files
committed
enhanced the pubsub
1 parent 56861b7 commit ed3e5cb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

main.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ func main() {
6161
}
6262

6363
// our internal change log
64-
changelog.Broadcast(Change{
65-
Namespace: ctx["db"].(string),
66-
Command: todo,
67-
Arguments: args,
68-
}, defaultPubSubAllTopic)
64+
if changelog.Subscribers(defaultPubSubAllTopic) > 0 {
65+
changelog.Broadcast(Change{
66+
Namespace: ctx["db"].(string),
67+
Command: todo,
68+
Arguments: args,
69+
}, defaultPubSubAllTopic)
70+
}
6971

7072
// internal ping-pong
7173
if todo == "ping" {

0 commit comments

Comments
 (0)