[#1628] fixed realtime panic on concurrent clients iteration

This commit is contained in:
Gani Georgiev
2023-01-18 15:41:33 +02:00
parent c1921aeef8
commit 7001a22d92
6 changed files with 101 additions and 13 deletions
+7
View File
@@ -24,6 +24,13 @@ func TestClients(t *testing.T) {
b.Register(subscriptions.NewDefaultClient())
b.Register(subscriptions.NewDefaultClient())
// check if it is a shallow copy
clients := b.Clients()
for k := range clients {
delete(clients, k)
}
// should return a new copy
if total := len(b.Clients()); total != 2 {
t.Fatalf("Expected 2 clients, got %v", total)
}