prepare for release
This commit is contained in:
@@ -297,6 +297,15 @@ func (t *TorrentManager) writeToFile(torrentID string, torrent *Torrent) {
|
||||
|
||||
func (t *TorrentManager) readFromFile(torrentID string) *Torrent {
|
||||
filePath := fmt.Sprintf("data/%s.bin", torrentID)
|
||||
fileInfo, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if time.Since(fileInfo.ModTime()) > time.Duration(t.config.GetCacheTimeHours())*time.Hour {
|
||||
return nil
|
||||
}
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user