Skip to content

Commit

Permalink
fix(messenger)_: stop broadcasting status once messenger is shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
osmaczko committed Feb 10, 2025
1 parent 989b412 commit 9b25f93
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions protocol/messenger_status_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@ func (m *Messenger) broadcastLatestUserStatus() {
ctx := context.Background()
go func() {
defer gocommon.LogOnPanic()

select {
// Ensure that we are connected before sending a message
time.Sleep(5 * time.Second)
m.sendCurrentUserStatus(ctx)
}()
case <-time.After(5 * time.Second):
m.sendCurrentUserStatus(ctx)
case <-m.quit:
return
}

go func() {
defer gocommon.LogOnPanic()
for {
select {
case <-time.After(5 * time.Minute):
Expand Down

0 comments on commit 9b25f93

Please sign in to comment.