From c4af5f9e970a9fe6dbfa217697bbcadbc0a9716f Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Fri, 26 Aug 2022 18:27:54 +0200 Subject: [PATCH] Revert "fileprop cache" This reverts commit 96189ef1bf864625b6cf4e7e4b03678cefaa5cce. --- envvars.go | 11 ++++------- file_properties.go | 17 +++-------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/envvars.go b/envvars.go index 3d036c3..2880637 100644 --- a/envvars.go +++ b/envvars.go @@ -11,7 +11,10 @@ import ( ) var ( - PollRate = envvars.Duration("POLL_RATE", 30*time.Minute) + Uid = envvars.Int("UID", 1000) + Gid = envvars.Int("GID", 1000) + + PollRate = envvars.Object("POLL_RATE", 30*time.Minute, time.ParseDuration) AnilistUsername = envvars.String("ANILIST_USERNAME", "username") AnilistAccessToken = envvars.String("ANILIST_TOKEN", "") @@ -70,13 +73,7 @@ var ( /* TODO - better idea? implementation in torrent_sort.go (sort.Slice) - PreferredTorrents = envvars.StringSlice("PREFERRED_TORRENTS", []string{"seeders", "subtitles", "languages", "downloads"}) - - old idea? PreferMoreLanguages = envvars.Bool("PREFERER_MORE_LANGUAGES", false) PreferMoreSubtitles = envvars.Bool("PREFERER_MORE_SUBTITLES", false) - PreferMoreSeeders = envvars.Bool("PREFERER_MORE_SEEDERS", false) - PreferMoreDownloads = envvars.Bool("PREFERER_MORE_DOWNLOADS", false) */ ) diff --git a/file_properties.go b/file_properties.go index a77c9be..cf2e766 100644 --- a/file_properties.go +++ b/file_properties.go @@ -18,20 +18,9 @@ type FileProperties struct { var _ model.PropertyHolder = &FileProperties{} -var filePropCache = map[string]*FileProperties{} - -func AnalyzeFile(path string) (props *FileProperties, err error) { - // caching - if cacheEntry, ok := filePropCache[path]; ok { - return cacheEntry, nil - } - defer func() { - if err == nil { - filePropCache[path] = props - } - }() - - props = &FileProperties{Filepath: path} +// TODO cache +func AnalyzeFile(path string) (*FileProperties, error) { + props := &FileProperties{Filepath: path} file, err := os.Open(path) if err != nil {