This commit is contained in:
Mukhtar Akere
2025-03-31 06:15:41 +01:00
parent face86e151
commit f9addaed36
2 changed files with 5 additions and 2 deletions

View File

@@ -483,7 +483,10 @@ func (c *Cache) ProcessTorrent(t *types.Torrent, refreshRclone bool) error {
for _, file := range t.Files { for _, file := range t.Files {
if file.Link == "" { if file.Link == "" {
c.logger.Debug().Msgf("Torrent %s is not complete, missing link for file %s. Triggering a reinsert", t.Id, file.Name) c.logger.Debug().Msgf("Torrent %s is not complete, missing link for file %s. Triggering a reinsert", t.Id, file.Name)
c.reinsertTorrent(t) if err := c.ReInsertTorrent(t); err != nil {
c.logger.Error().Err(err).Msgf("Failed to reinsert torrent %s", t.Id)
return fmt.Errorf("failed to reinsert torrent: %w", err)
}
} }
} }

View File

@@ -119,7 +119,7 @@ func (c *Cache) submitForRepair(repairType RepairType, torrentId, fileName strin
} }
} }
func (c *Cache) reinsertTorrent(torrent *types.Torrent) error { func (c *Cache) ReInsertTorrent(torrent *types.Torrent) error {
// Check if Magnet is not empty, if empty, reconstruct the magnet // Check if Magnet is not empty, if empty, reconstruct the magnet
if _, ok := c.repairsInProgress.Load(torrent.Id); ok { if _, ok := c.repairsInProgress.Load(torrent.Id); ok {
return fmt.Errorf("repair already in progress for torrent %s", torrent.Id) return fmt.Errorf("repair already in progress for torrent %s", torrent.Id)