Skip to content

Commit

Permalink
Pool size config documentation (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob authored Dec 12, 2024
1 parent 7ec3045 commit 67c5b9d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ Req.get!(req, url: "https://api.github.com/user").body["login"]

See [`Req.Request`] module documentation for more information on low-level API, request struct, and developing plugins.

## Configuration

Req supports many configuration options, see [`Req.new/1`] for a full list and see each step for
more details. In particular, if you are looking for slightly lower level HTTP options such as
timeouts, pool sizes, and certificates, see the [`run_finch`] documentation.

## Related Packages

There are many packages that extend the Req library. To get yours listed here, send a PR.
Expand Down
18 changes: 18 additions & 0 deletions lib/req/steps.ex
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,24 @@ defmodule Req.Steps do
Req.get!("https://httpbin.org/json", finch: MyFinch)
More commonly you'd add the the custom Finch pool as part of your supervision tree in your
`application.ex`:
children = [
{Finch,
name: MyFinch,
pools: %{
default: [size: 70]
}}
]
That way you can also configure a bigger pool size for the HTTP pool. You just mustn't forget to
pass along `finch: MyFinch` as discussed above. You could use `Req.default_options/1` to make it
a global default but it's generally discouraged.
For documentation about the possible pool options and their meaning, please check out the
[Finch docs on pool configuration options](https://hexdocs.pm/finch/Finch.html#start_link/1-pool-configuration-options).
## Request Options
* `:finch` - the name of the Finch pool. Defaults to a pool automatically started by Req.
Expand Down

0 comments on commit 67c5b9d

Please sign in to comment.