fix(communities): only update last seen magnetlink when download was successful

This commit is contained in:
Pascal Precht 2023-01-18 13:16:07 +01:00 committed by r4bbit
parent eb2b4b7cdc
commit 81d4b5e0d7
1 changed files with 5 additions and 5 deletions

View File

@ -997,6 +997,11 @@ func (m *Messenger) downloadAndImportHistoryArchives(id types.HexBytes, magnetli
return return
} }
err = m.communitiesManager.UpdateLastSeenMagnetlink(id, magnetlink)
if err != nil {
m.communitiesManager.LogStdout("couldn't update last seen magnetlink", zap.Error(err))
}
err = m.importHistoryArchives(id, cancel) err = m.importHistoryArchives(id, cancel)
if err != nil { if err != nil {
m.communitiesManager.LogStdout("failed to import history archives", zap.Error(err)) m.communitiesManager.LogStdout("failed to import history archives", zap.Error(err))
@ -1004,12 +1009,7 @@ func (m *Messenger) downloadAndImportHistoryArchives(id types.HexBytes, magnetli
return return
} }
err = m.communitiesManager.UpdateLastSeenMagnetlink(id, magnetlink)
if err != nil {
m.communitiesManager.LogStdout("couldn't update last seen magnetlink", zap.Error(err))
}
m.config.messengerSignalsHandler.DownloadingHistoryArchivesFinished(types.EncodeHex(id)) m.config.messengerSignalsHandler.DownloadingHistoryArchivesFinished(types.EncodeHex(id))
} }
func (m *Messenger) handleArchiveMessages(archiveMessages []*protobuf.WakuMessage, id types.HexBytes) (*MessengerResponse, error) { func (m *Messenger) handleArchiveMessages(archiveMessages []*protobuf.WakuMessage, id types.HexBytes) (*MessengerResponse, error) {