From 66958e5032bc56f78ca4bcdb05e303fc13d5aeb6 Mon Sep 17 00:00:00 2001
From: or-else <or.else@gmail.com>
Date: Fri, 2 Jun 2023 11:07:37 -0700
Subject: [PATCH] create sys topic in all nodes

---
 server/db/mongodb/tests/mongo_test.go | 4 ++--
 server/hub.go                         | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/server/db/mongodb/tests/mongo_test.go b/server/db/mongodb/tests/mongo_test.go
index daae34af..8956919b 100644
--- a/server/db/mongodb/tests/mongo_test.go
+++ b/server/db/mongodb/tests/mongo_test.go
@@ -523,7 +523,7 @@ func TestSubsForTopic(t *testing.T) {
 
 func TestFindUsers(t *testing.T) {
 	reqTags := [][]string{{"alice", "bob", "carol"}}
-	gotSubs, err := adp.FindUsers(types.ParseUserId("usr"+users[2].Id), reqTags, nil)
+	gotSubs, err := adp.FindUsers(types.ParseUserId("usr"+users[2].Id), reqTags, nil, true)
 	if err != nil {
 		t.Error(err)
 	}
@@ -534,7 +534,7 @@ func TestFindUsers(t *testing.T) {
 
 func TestFindTopics(t *testing.T) {
 	reqTags := [][]string{{"travel", "qwer", "asdf", "zxcv"}}
-	gotSubs, err := adp.FindTopics(reqTags, nil)
+	gotSubs, err := adp.FindTopics(reqTags, nil, true)
 	if err != nil {
 		t.Error(err)
 	}
diff --git a/server/hub.go b/server/hub.go
index e86c4556..61c84e2b 100644
--- a/server/hub.go
+++ b/server/hub.go
@@ -142,10 +142,8 @@ func newHub() *Hub {
 
 	go h.run()
 
-	if !globals.cluster.isRemoteTopic("sys") {
-		// Initialize system 'sys' topic. There is only one sys topic per cluster.
-		h.join <- &ClientComMessage{RcptTo: "sys", Original: "sys"}
-	}
+	// Initialize 'sys' topic. It will be initialized either as master or proxy.
+	h.join <- &ClientComMessage{RcptTo: "sys", Original: "sys"}
 
 	return h
 }
-- 
GitLab