Use dedicated http client pool for MusicBrainz

This commit is contained in:
Claudio Ortolina
2024-11-07 21:06:23 +00:00
parent 64193858a6
commit d8b7efeebc
3 changed files with 19 additions and 3 deletions
+2 -2
View File
@@ -249,7 +249,7 @@ defmodule MusicBrainz.APIImpl do
Logger.debug("Fetching data from #{url}")
case Finch.request(req, MusicLibrary.Finch) do
case Finch.request(req, MusicBrainz.Finch) do
{:ok, response} when response.status == 200 ->
{:ok, Jason.decode!(response.body)}
@@ -268,7 +268,7 @@ defmodule MusicBrainz.APIImpl do
Logger.debug("Fetching data from #{url}")
case Finch.request(req, MusicLibrary.Finch) do
case Finch.request(req, MusicBrainz.Finch) do
{:ok, response} when response.status == 200 ->
{:ok, response.body}
+16
View File
@@ -0,0 +1,16 @@
defmodule MusicBrainz.Supervisor do
use Supervisor
def start_link(config) do
Supervisor.start_link(__MODULE__, config, name: __MODULE__)
end
@impl true
def init(_config) do
children = [
{Finch, name: MusicBrainz.Finch}
]
Supervisor.init(children, strategy: :one_for_one)
end
end