From 4fb2ab354c2ab0ce77f4b6d66a00cf200555d16d Mon Sep 17 00:00:00 2001 From: Ryan Coy Date: Wed, 14 Apr 2021 16:56:05 +0200 Subject: [PATCH] Fix internet cache invalidation Bug was spotted and reported on Slack today - as it stands, nothing is ever invalidated because we pretty much eternally live in negative date-time space, which will always be less than a positive TimeSpan. --- src/CommonRuntime/Caching.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CommonRuntime/Caching.fs b/src/CommonRuntime/Caching.fs index 1bec449eb..692a9aef8 100644 --- a/src/CommonRuntime/Caching.fs +++ b/src/CommonRuntime/Caching.fs @@ -93,7 +93,7 @@ let createInternetFileCache prefix expiration = failwith "Not implemented" let cacheFile = cacheFile key try - if File.Exists cacheFile && File.GetLastWriteTimeUtc cacheFile - DateTime.UtcNow < expiration then + if File.Exists cacheFile && DateTime.UtcNow - File.GetLastWriteTimeUtc cacheFile < expiration then let result = File.ReadAllText cacheFile if isWellFormedResult result then Some result