fix: increase mute interval check

Each 3 seconds is much too frequent, it leads to all communities being
read from the database and as a consequence to extensive memory
consumption (most likely garbage collector was not fast enough to
cleanup allocated memory).

mitigates: status-im/status-desktop#14281
This commit is contained in:
Patryk Osmaczko 2024-04-03 22:46:15 +02:00 committed by Jonathan Rainville
parent e1cd91fafe
commit 107d7a9822
1 changed files with 2 additions and 2 deletions

View File

@ -1561,7 +1561,7 @@ func (m *Messenger) watchChatsAndCommunitiesToUnmute() {
go func() { go func() {
for { for {
select { select {
case <-time.After(3 * time.Second): // Poll every 3 seconds case <-time.After(1 * time.Minute):
response := &MessengerResponse{} response := &MessengerResponse{}
m.allChats.Range(func(chatID string, c *Chat) bool { m.allChats.Range(func(chatID string, c *Chat) bool {
chatMuteTill, _ := time.Parse(time.RFC3339, c.MuteTill.Format(time.RFC3339)) chatMuteTill, _ := time.Parse(time.RFC3339, c.MuteTill.Format(time.RFC3339))
@ -1596,7 +1596,7 @@ func (m *Messenger) watchCommunitiesToUnmute() {
go func() { go func() {
for { for {
select { select {
case <-time.After(3 * time.Second): // Poll every 3 seconds case <-time.After(1 * time.Minute):
response, err := m.CheckCommunitiesToUnmute() response, err := m.CheckCommunitiesToUnmute()
if err != nil { if err != nil {
return return