fix(communities): ensure existing archives are seeded on startup
This commit is contained in:
parent
9ee2967e78
commit
eb4ab9316c
|
@ -2096,6 +2096,11 @@ func (m *Manager) LoadHistoryArchiveIndexFromFile(communityID types.HexBytes) (*
|
||||||
return wakuMessageArchiveIndexProto, nil
|
return wakuMessageArchiveIndexProto, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Manager) TorrentFileExists(communityID string) bool {
|
||||||
|
_, err := os.Stat(m.torrentFile(communityID))
|
||||||
|
return err == nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Manager) torrentFile(communityID string) string {
|
func (m *Manager) torrentFile(communityID string) string {
|
||||||
return m.torrentConfig.TorrentDir + "/" + communityID + ".torrent"
|
return m.torrentConfig.TorrentDir + "/" + communityID + ".torrent"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1601,6 +1601,14 @@ func (m *Messenger) InitHistoryArchiveTasks(communities []*communities.Community
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if there's already a torrent file for this community and seed it
|
||||||
|
if m.communitiesManager.TorrentFileExists(c.IDString()) {
|
||||||
|
err = m.communitiesManager.SeedHistoryArchiveTorrent(c.ID())
|
||||||
|
if err != nil {
|
||||||
|
m.logger.Debug("failed to seed history archive", zap.Error(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
filters, err := m.communitiesManager.GetCommunityChatsFilters(c.ID())
|
filters, err := m.communitiesManager.GetCommunityChatsFilters(c.ID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.logger.Debug("failed to get community chats filters", zap.Error(err))
|
m.logger.Debug("failed to get community chats filters", zap.Error(err))
|
||||||
|
|
Loading…
Reference in New Issue