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 dependency inversion on pool exhausted #297

Open
carrascoacd opened this issue Feb 4, 2025 · 0 comments
Open

Avoid dependency inversion on pool exhausted #297

carrascoacd opened this issue Feb 4, 2025 · 0 comments

Comments

@carrascoacd
Copy link

carrascoacd commented Feb 4, 2025

Problem

When using Finch is expected to receive a RuntimeError if the connection pool is exhausted, see https://github.com/sneako/finch/blob/main/test/finch_test.exs#L561

This is a problem because in a service that uses a lower tier API than the service itself, a dependency inversion of tiers can happen. For example, a tier 2 service calling a tier 3 service.

The tier inversion happens because we are not rescuing the error and returning it into a tuple, so the operation can work without problems under this situation.

Proposed solution

For clients using Tesla: elixir-tesla/tesla#744

Unresolved questions

  • Is this behavior expected, and why?
  • Do you think this reraise should be changed to return an error tuple instead, so we don't provoke the linked caller to exit?

cc/ @yordis @sneako

@carrascoacd carrascoacd changed the title Use rescue to avoid dependency inversion Avoid dependency inversion on pool exhausted Feb 4, 2025
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

No branches or pull requests

1 participant