Fix repair bug; fix torrent refreshes

This commit is contained in:
Mukhtar Akere
2025-04-19 10:41:45 +01:00
parent 52877107c9
commit dc8ee3d150
9 changed files with 150 additions and 67 deletions

View File

@@ -258,7 +258,19 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// - Otherwise, for deeper (torrent folder) paths, use a longer TTL.
ttl := 1 * time.Minute
if h.isParentPath(r.URL.Path) {
// __all__ or torrents folder
// Manually build the xml
ttl = 30 * time.Second
if served := h.serveFromCacheIfValid(w, r, cacheKey, ttl); served {
return
}
// Refresh the parent XML
h.cache.RefreshListings(false)
// Check again if the cache is valid
// If not, we will use the default WebDAV handler
if served := h.serveFromCacheIfValid(w, r, cacheKey, ttl); served {
return
}
}
if served := h.serveFromCacheIfValid(w, r, cacheKey, ttl); served {