Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

WIP: Timeout #11

wants to merge 2 commits into from

Conversation

goosedb
Copy link

@goosedb goosedb commented Aug 18, 2022

Implements #10

@goosedb goosedb changed the title Timeout WIP: Timeout Aug 18, 2022
@goosedb
Copy link
Author

goosedb commented Aug 18, 2022

Should we add tests? @arybczak

@goosedb
Copy link
Author

goosedb commented Sep 12, 2022

@arybczak

Copy link
Contributor

@arybczak arybczak left a 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"
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants