From 90122f3e2e579c6675c21c0b04e87e8aedfed2e2 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Thu, 9 Dec 2021 09:50:58 +0100 Subject: [PATCH] fix: only broadcast status once we are connected (#2456) --- protocol/messenger_status_updates.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protocol/messenger_status_updates.go b/protocol/messenger_status_updates.go index 98fbf2ad6..e334c5d59 100644 --- a/protocol/messenger_status_updates.go +++ b/protocol/messenger_status_updates.go @@ -181,7 +181,12 @@ func (m *Messenger) sendCurrentUserStatusToCommunity(ctx context.Context, commun func (m *Messenger) broadcastLatestUserStatus() { m.logger.Debug("broadcasting user status") ctx := context.Background() - m.sendCurrentUserStatus(ctx) + go func() { + // Ensure that we are connected before sending a message + time.Sleep(5 * time.Second) + m.sendCurrentUserStatus(ctx) + }() + go func() { for { select {