- Fix nil checks

- Enable add arr to config page
- Other minor fixes
This commit is contained in:
Mukhtar Akere
2025-04-27 23:43:19 +01:00
parent a3e64cc269
commit f977c52571
6 changed files with 41 additions and 35 deletions

View File

@@ -621,13 +621,12 @@ func (c *Cache) GetClient() types.Client {
}
func (c *Cache) DeleteTorrent(id string) error {
c.logger.Info().Msgf("Deleting torrent %s from cache", id)
c.torrentsRefreshMu.Lock()
defer c.torrentsRefreshMu.Unlock()
if c.deleteTorrent(id, true) {
c.RefreshListings(true)
c.logger.Info().Msgf("Torrent %s deleted successfully", id)
c.logger.Trace().Msgf("Torrent %s deleted successfully", id)
return nil
}
return nil

View File

@@ -55,12 +55,16 @@ func (c *Cache) IsTorrentBroken(t *CachedTorrent, filenames []string) bool {
// Check if file is missing
if f.Link == "" {
// refresh torrent and then break
t = c.refreshTorrent(t)
break
if newT := c.refreshTorrent(t); newT != nil {
t = newT
} else {
c.logger.Error().Str("torrentId", t.Torrent.Id).Msg("Failed to refresh torrent")
return true
}
}
}
if t == nil || t.Torrent == nil {
if t.Torrent == nil {
c.logger.Error().Str("torrentId", t.Torrent.Id).Msg("Failed to refresh torrent")
return true
}