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

Avoid creating many connection managers #25

Open
dcastro opened this issue Feb 26, 2022 · 0 comments · May be fixed by #54
Open

Avoid creating many connection managers #25

dcastro opened this issue Feb 26, 2022 · 0 comments · May be fixed by #54
Assignees

Comments

@dcastro
Copy link
Member

dcastro commented Feb 26, 2022

In runVaultIO, we're creating a new connection manager on every BackendEffect action:

    env <-
      case url of
        (BaseUrl Http _ _ _) -> do
          manager <- embed $ newManager defaultManagerSettings
          pure $ mkClientEnv manager url
        (BaseUrl Https _ _ _) -> do
          manager <- embed $ newManager tlsManagerSettings
          pure $ mkClientEnv manager url

This can be observed by adding a trace statement:

          manager <- embed $ do
            traceM "Creating manager"
            newManager defaultManagerSettings

And then running coffer view / (after creating a few entries):

$ cabal run exe:coffer -- view /

"Creating manager"
"Creating manager"
"Creating manager"
"Creating manager"
"Creating manager"
"Creating manager"
"Creating manager"
"Creating manager"
/
  test/
    ...

We should refactor this so only 1 connection manager is created.

DK318 added a commit that referenced this issue Apr 1, 2022
Problem: at this moment we are creating one connection manager per `BackendEffect`.
This seems ridiculous.

Solution: added `Member (State (Maybe Manager))` constraint in `Sem` to store only one
connection manager for all `BackendEffect` actions.
@DK318 DK318 linked a pull request Apr 1, 2022 that will close this issue
8 tasks
@DK318 DK318 self-assigned this Apr 1, 2022
DK318 added a commit that referenced this issue Apr 4, 2022
DK318 added a commit that referenced this issue Apr 4, 2022
Problem: at this moment we are creating one connection manager per `BackendEffect`.
This seems ridiculous.

Solution: added `Member (State (Maybe Manager))` constraint in `Sem` to store only one
connection manager for all `BackendEffect` actions.
DK318 added a commit that referenced this issue Apr 4, 2022
DK318 added a commit that referenced this issue Apr 4, 2022
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 a pull request may close this issue.

2 participants