diff --git a/protocol/messenger.go b/protocol/messenger.go index f0a0b39dc..3e27b6486 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -89,7 +89,7 @@ var ( ErrChatNotFoundError = errors.New("Chat not found") ) -var communityAdvertiseIntervalSecond int64 = 60 * 60 +const communityAdvertiseIntervalSecond int64 = 24 * 60 * 60 // messageCacheIntervalMs is how long we should keep processed messages in the cache, in ms var messageCacheIntervalMs uint64 = 1000 * 60 * 60 * 48 diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go index bd2ea46cf..59c7546bf 100644 --- a/protocol/messenger_communities.go +++ b/protocol/messenger_communities.go @@ -299,26 +299,12 @@ func (m *Messenger) handleCommunitiesSubscription(c chan *communities.Subscripti // We check every 5 minutes if we need to publish ticker := time.NewTicker(5 * time.Minute) - recentlyPublishedOrgs := func() map[string]*communities.Community { - result := make(map[string]*communities.Community) - - controlledCommunities, err := m.communitiesManager.Controlled() - if err != nil { - m.logger.Warn("failed to retrieve orgs", zap.Error(err)) - return result - } - - for _, org := range controlledCommunities { - result[org.IDString()] = org - } - - return result - }() + recentlyPublishedOrgs := make(map[string]*communities.Community, 0) publishOrgAndDistributeEncryptionKeys := func(community *communities.Community) { recentlyPublishedOrg := recentlyPublishedOrgs[community.IDString()] - if recentlyPublishedOrg != nil && community.Clock() <= recentlyPublishedOrg.Clock() { + if recentlyPublishedOrg != nil && community.Clock() < recentlyPublishedOrg.Clock() { return }