-
Notifications
You must be signed in to change notification settings - Fork 135
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
parallel http requests are responded in the same order as the cassette #127
Comments
I have a similar problem, in the latest iteration of the code this is shown even with a simple async stream: Symbol.supported()
|> Task.async_stream(fn symbol ->
HTTPoison.get(url, [], params: %{"indicator" => indicator, "exchange" => "binance", "symbol" => symbol, "interval" => interval, "candlesCount" => candles})
end)
|> Enum.into([], fn {:ok, {:ok, %HTTPoison.Response{body: body, request: %HTTPoison.Request{params: %{"symbol" => symbol}}}}} -> %{symbol => Poison.decode!(body)} end) the cassette gets registrered properly, however the test doesn't pass: defmodule Pandamex.IndicatorTest do
use ExUnit.Case, async: true
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney, options: [clear_mock: true]
alias Pandamex.Indicator
setup_all do
HTTPoison.start()
end
describe "Pandamex.Indicator.get/4" do
@tag timeout: :infinity
test "works" do
use_cassette "indicators/get_indicators" do
assert Indicator.get() == [
%{"BTC/USDT" => %{"value" => 45.67296250448912}},
%{"ETH/USDT" => %{"value" => 44.17848150108721}},
%{"XRP/USDT" => %{"value" => 47.02039812884717}},
%{"LTC/USDT" => %{"value" => 52.7422974568094}},
%{"XMR/USDT" => %{"value" => 54.31603149404031}}
]
end
end
end
end
as you can see it returns the value of the first entry in the cassette |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, i'm getting errors when doing parallel http request that are responded from a cassette.
I'm fetching some records from an API and then fetching details for each record from a different API using Tasks, but it seems ExVcr is using the cassette to respond in the same order the requests were first made, but, because requests are run in parallel i'm getting answers mixed up
The text was updated successfully, but these errors were encountered: