chore(no-torrent)_: removed TorrentManager from handleImportedMessages

This commit is contained in:
Samuel Hawksby-Robinson 2024-06-02 18:52:39 +01:00
parent 66d57a3fd0
commit 96b4684647
1 changed files with 5 additions and 5 deletions

View File

@ -3743,11 +3743,11 @@ func (m *Messenger) handleImportedMessages(messagesToHandle map[transport.Filter
importMessagesToSave := messageState.Response.DiscordMessages()
if len(importMessagesToSave) > 0 {
m.torrentManager.LogStdout(fmt.Sprintf("saving %d discord messages", len(importMessagesToSave)))
m.logger.Debug(fmt.Sprintf("saving %d discord messages", len(importMessagesToSave)))
m.handleImportMessagesMutex.Lock()
err := m.persistence.SaveDiscordMessages(importMessagesToSave)
if err != nil {
m.torrentManager.LogStdout("failed to save discord messages", zap.Error(err))
m.logger.Debug("failed to save discord messages", zap.Error(err))
m.handleImportMessagesMutex.Unlock()
return err
}
@ -3756,11 +3756,11 @@ func (m *Messenger) handleImportedMessages(messagesToHandle map[transport.Filter
messageAttachmentsToSave := messageState.Response.DiscordMessageAttachments()
if len(messageAttachmentsToSave) > 0 {
m.torrentManager.LogStdout(fmt.Sprintf("saving %d discord message attachments", len(messageAttachmentsToSave)))
m.logger.Debug(fmt.Sprintf("saving %d discord message attachments", len(messageAttachmentsToSave)))
m.handleImportMessagesMutex.Lock()
err := m.persistence.SaveDiscordMessageAttachments(messageAttachmentsToSave)
if err != nil {
m.torrentManager.LogStdout("failed to save discord message attachments", zap.Error(err))
m.logger.Debug("failed to save discord message attachments", zap.Error(err))
m.handleImportMessagesMutex.Unlock()
return err
}
@ -3769,7 +3769,7 @@ func (m *Messenger) handleImportedMessages(messagesToHandle map[transport.Filter
messagesToSave := messageState.Response.Messages()
if len(messagesToSave) > 0 {
m.torrentManager.LogStdout(fmt.Sprintf("saving %d app messages", len(messagesToSave)))
m.logger.Debug(fmt.Sprintf("saving %d app messages", len(messagesToSave)))
m.handleMessagesMutex.Lock()
err := m.SaveMessages(messagesToSave)
if err != nil {