added cache folder check

This commit is contained in:
partisan 2024-12-02 09:20:42 +01:00
parent 44e9d3356f
commit ff84d49ff3
2 changed files with 16 additions and 12 deletions

View file

@ -70,6 +70,14 @@ func main() {
printInfo("Node client is disabled.")
}
// Check if the cache directory exists when caching is enabled
if config.DriveCacheEnabled {
if _, err := os.Stat(config.DriveCache.Path); os.IsNotExist(err) {
printErr("Error: Drive cache is enabled, but cache directory '%s' does not exist.\n", config.DriveCache.Path)
os.Exit(1) // Exit with a non-zero status to indicate an error
}
}
// Start periodic cleanup of expired cache files
if config.DriveCacheEnabled {
go cleanExpiredCachedImages()