fix: only broadcast status once we are connected (#2456)

This commit is contained in:
Anthony Laibe 2021-12-09 09:50:58 +01:00 committed by GitHub
parent 9feea4fe25
commit 90122f3e2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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 {