Skip to content

Commit

Permalink
feat: match demand, add longer timeout and retries. (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziinc authored Jan 1, 2024
1 parent c00d0ba commit 1a00386
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ defmodule Loadfest.Client do

Tesla.client(
[
{Tesla.Middleware.Timeout, timeout: 15_000},
{Tesla.Middleware.Retry, delay: 500, max_retries: 10, max_delay: 5_000},
{Tesla.Middleware.BaseUrl, endpoint},
{
Tesla.Middleware.Headers,
Expand Down
2 changes: 1 addition & 1 deletion lib/pipeline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Loadfest.Pipeline do

def handle_demand(demand, state) when demand > 0 do
messages =
for batch_size <- Loadfest.Worker.stream_batch_sizes() |> Enum.take(2),
for batch_size <- Loadfest.Worker.stream_batch_sizes() |> Enum.take(demand),
events = Loadfest.Worker.stream_batch() |> Enum.take(batch_size) do
%Broadway.Message{data: events, acknowledger: {__MODULE__, :ack, 3}}
end
Expand Down

0 comments on commit 1a00386

Please sign in to comment.