[#4671] Increase interval between calls to Directory contract (#4672)

This commit is contained in:
Roman Volosovskyi 2024-02-05 14:01:59 +01:00 committed by GitHub
parent 4584de34b0
commit 2dc1b48968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -14,7 +14,8 @@ import (
) )
const ( const (
curatedCommunitiesUpdateInterval = 2 * time.Minute curatedCommunitiesUpdateInterval = time.Hour
communitiesUpdateFailureInterval = time.Minute
) )
// Regularly gets list of curated communities and signals them to client // Regularly gets list of curated communities and signals them to client
@ -39,6 +40,7 @@ func (m *Messenger) startCuratedCommunitiesUpdateLoop() {
curatedCommunities, err := m.getCuratedCommunitiesFromContract() curatedCommunities, err := m.getCuratedCommunitiesFromContract()
if err != nil { if err != nil {
interval = communitiesUpdateFailureInterval
logger.Error("failed to get curated communities from contract", zap.Error(err)) logger.Error("failed to get curated communities from contract", zap.Error(err))
continue continue
} }
@ -58,6 +60,7 @@ func (m *Messenger) startCuratedCommunitiesUpdateLoop() {
response, err := m.fetchCuratedCommunities(curatedCommunities) response, err := m.fetchCuratedCommunities(curatedCommunities)
if err != nil { if err != nil {
interval = communitiesUpdateFailureInterval
logger.Error("failed to fetch curated communities", zap.Error(err)) logger.Error("failed to fetch curated communities", zap.Error(err))
continue continue
} }