-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Timeout #11
base: master
Are you sure you want to change the base?
WIP: Timeout #11
Conversation
Should we add tests? @arybczak |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for such a long delay.
Now that backwards-compatible changes can be introduced to PoolConfig, do you mind rebasing over master and bumping the version to 0.4.1.0?
@@ -87,6 +104,8 @@ newPool pc = do | |||
error "poolCacheTTL must be at least 0.5" | |||
when (poolMaxResources pc < 1) $ do | |||
error "poolMaxResources must be at least 1" | |||
when (maybe False (< 0) (acquireResourceTimeout <$> poolTimeoutConfig pc)) $ do | |||
error "acquireResourceTimeout must be at least 0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue it should be more than 0 :)
@@ -24,6 +26,9 @@ data Pool a = Pool | |||
, reaperRef :: !(IORef ()) | |||
} | |||
|
|||
getPoolTimeoutConfig :: Pool a -> Maybe TimeoutConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue we can do without this helper function.
data TimeoutConfig = TimeoutConfig | ||
{ acquireResourceTimeout :: Int | ||
-- ^ Time to await, microseconds | ||
, timeoutLabel :: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to provide a value that should be thrown as exception here instead of a label?
Then you can also get rid of the TimeoutException
.
Implements #10