fix: decouple permissions reevaluation from torrent client readiness

This commit is contained in:
Patryk Osmaczko 2023-10-20 00:15:45 +02:00 committed by osmaczko
parent bd245ab45b
commit dc6fe5613a
1 changed files with 15 additions and 13 deletions

View File

@ -835,22 +835,24 @@ func (m *Messenger) Start() (*MessengerResponse, error) {
return nil, err
}
if m.torrentClientReady() {
controlledCommunities, err := m.communitiesManager.Controlled()
if err == nil && len(controlledCommunities) > 0 {
if err != nil {
return nil, err
}
if m.torrentClientReady() {
available := m.SubscribeMailserverAvailable()
go func() {
<-available
m.InitHistoryArchiveTasks(controlledCommunities)
}()
}
for _, c := range controlledCommunities {
if c.Joined() && c.HasTokenPermissions() {
go m.communitiesManager.ReevaluateMembersPeriodically(c.ID())
}
}
}
}
joinedCommunities, err := m.communitiesManager.Joined()
if err != nil {