Skip to content

Commit

Permalink
add optional timeout to send_transaction_with_await_replication
Browse files Browse the repository at this point in the history
  • Loading branch information
bchamagne authored and Neylix committed Jul 21, 2023
1 parent 905c510 commit 672a479
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/archethic/utils/regression/playbook.ex
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ defmodule Archethic.Utils.Regression.Playbook do
host,
port,
curve \\ Crypto.default_curve(),
proto \\ :http
proto \\ :http,
opts \\ []
) do
chain_length = get_chain_size(transaction_seed, curve, host, port, proto)

Expand Down Expand Up @@ -256,7 +257,10 @@ defmodule Archethic.Utils.Regression.Playbook do
proto
) do
{:ok, %{"status" => "pending"}} ->
case Task.yield(replication_attestation, 5_000) || Task.shutdown(replication_attestation) do
await_timeout = Keyword.get(opts, :await_timeout, 5_000)

case Task.yield(replication_attestation, await_timeout) ||
Task.shutdown(replication_attestation) do
{:ok, :ok} ->
{:ok, tx.address}

Expand Down

0 comments on commit 672a479

Please sign in to comment.