Make object recovery settlement-safe
This commit is contained in:
parent
cc23211e63
commit
cd83841520
1 changed files with 1054 additions and 90 deletions
|
|
@ -51,6 +51,7 @@ data Config = Config
|
|||
, cfgSearchMaxKeys :: Int
|
||||
, cfgRecoveryGraceSec :: Integer
|
||||
, cfgIdempotencyWindowSec :: Integer
|
||||
, cfgObjectRequestTimeoutSec :: Integer
|
||||
}
|
||||
|
||||
loadConfig :: IO Config
|
||||
|
|
@ -114,8 +115,13 @@ loadConfig = do
|
|||
searchMax <- fromInteger <$> envInteger "NUTHATCH_SEARCH_MAX_KEYS" 500
|
||||
recoveryGrace <- envInteger "NUTHATCH_RECOVERY_GRACE_SEC" 90
|
||||
idempotencyWindow <- envInteger "NUTHATCH_IDEMPOTENCY_WINDOW_SEC" 86400
|
||||
objectRequestTimeout <- envInteger "NUTHATCH_OBJECT_REQUEST_TIMEOUT_SEC" 300
|
||||
when (recoveryGrace <= 0) $
|
||||
fail "NUTHATCH_RECOVERY_GRACE_SEC must be positive"
|
||||
when (idempotencyWindow <= 0) $
|
||||
fail "NUTHATCH_IDEMPOTENCY_WINDOW_SEC must be positive"
|
||||
when (objectRequestTimeout <= 0) $
|
||||
fail "NUTHATCH_OBJECT_REQUEST_TIMEOUT_SEC must be positive"
|
||||
pure Config
|
||||
{ cfgListenHost = host
|
||||
, cfgListenPort = port
|
||||
|
|
@ -153,6 +159,7 @@ loadConfig = do
|
|||
, cfgSearchMaxKeys = searchMax
|
||||
, cfgRecoveryGraceSec = recoveryGrace
|
||||
, cfgIdempotencyWindowSec = idempotencyWindow
|
||||
, cfgObjectRequestTimeoutSec = objectRequestTimeout
|
||||
}
|
||||
|
||||
luaExactIntegerMax :: Integer
|
||||
|
|
|
|||
Loading…
Reference in a new issue