Skip to content

Avoid creating many connection managers #25

@dcastro

Description

@dcastro

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions