Fix env check

This commit is contained in:
Daniel J. Summers 2022-04-19 20:43:16 -04:00
parent 26d7c9b140
commit 9a6b04412a

View File

@ -67,11 +67,8 @@ type DistributedRethinkDBCache (options : IOptions<DistributedRethinkDBCacheOpti
if log.IsEnabled LogLevel.Debug then log.LogDebug $"[{table}] %s{text ()}" if log.IsEnabled LogLevel.Debug then log.LogDebug $"[{table}] %s{text ()}"
/// Make sure the RethinkDB database, table, expiration index exist /// Make sure the RethinkDB database, table, expiration index exist
let checkEnvironment (_ : CancellationToken) = let environmentCheck (_ : CancellationToken) =
backgroundTask { backgroundTask {
if environmentChecked then
dbug <| fun () -> "Skipping environment check because it has already been performed"
return ()
dbug <| fun () -> "|> Checking for proper RethinkDB cache environment" dbug <| fun () -> "|> Checking for proper RethinkDB cache environment"
// Database // Database
match db with match db with
@ -109,6 +106,14 @@ type DistributedRethinkDBCache (options : IOptions<DistributedRethinkDBCacheOpti
environmentChecked <- true environmentChecked <- true
} }
/// Make sure the RethinkDB database, table, expiration index exist
let checkEnvironment (cnxToken : CancellationToken) =
backgroundTask {
match environmentChecked with
| true -> dbug <| fun () -> "Skipping environment check because it has already been performed"
| false -> do! environmentCheck cnxToken
}
/// Remove entries from the cache that are expired /// Remove entries from the cache that are expired
let purgeExpired (_ : CancellationToken) = let purgeExpired (_ : CancellationToken) =
backgroundTask { backgroundTask {