diff --git a/hash_cache.go b/hash_cache.go index 55c8212..e0f7277 100644 --- a/hash_cache.go +++ b/hash_cache.go @@ -29,7 +29,7 @@ func InitCache() { } go func() { - ticker := time.NewTicker(10 * time.Second) + ticker := time.NewTicker(FlagUpdateHashFileInterval) defer ticker.Stop() for range ticker.C { if err := WriteCache(); err != nil { diff --git a/main.go b/main.go index 6b728b2..b248f67 100644 --- a/main.go +++ b/main.go @@ -17,9 +17,10 @@ import ( ) var ( // flags - FlagSourceDir = envvars.String("SOURCE_PATH", "/video") - FlagTargetDir = envvars.String("TARGET_PATH", "/audio") - FlagCacheFile = envvars.String("CACHE_FILE", "/hashes.bin") + FlagSourceDir = envvars.String("SOURCE_PATH", "/video") + FlagTargetDir = envvars.String("TARGET_PATH", "/audio") + FlagCacheFile = envvars.String("CACHE_FILE", "/hashes.bin") + FlagUpdateHashFileInterval = envvars.Duration("UPDATE_CACHE_FILE_INTERVAL", 10*time.Second) ) func main() {