Skip to content

Commit

Permalink
Fix await confirmation + add protocol to ws handler
Browse files Browse the repository at this point in the history
  • Loading branch information
bchamagne authored and Neylix committed Jul 21, 2023
1 parent 672a479 commit d4a2693
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/archethic/utils/regression/playbook.ex
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,17 @@ defmodule Archethic.Utils.Regression.Playbook do
)

receive do
%{"transactionConfirmed" => %{"nbConfirmations" => 1}} ->
%{"transactionConfirmed" => %{"nbConfirmations" => n}} when n > 0 ->
:ok

%{"transactionError" => %{"reason" => reason}} ->
{:error, reason}

{:error, reason} ->
{:error, reason}

unknown_msg ->
Logger.warn("await_replication received an unknown message: #{inspect(unknown_msg)}")
end
end

Expand Down
3 changes: 2 additions & 1 deletion lib/archethic/utils/websocket/handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ defmodule Archethic.Utils.WebSocket.SocketHandler do
name = Keyword.get(opts, :ws_name, __MODULE__)
host = Keyword.get(opts, :host, "localhost")
port = Keyword.get(opts, :port, "4000")
protocol = Keyword.get(opts, :protocol, "ws")

ws_url = "ws://#{host}:#{port}/socket/websocket"
ws_url = "#{protocol}://#{host}:#{port}/socket/websocket"

state = %{
subscriptions: %{},
Expand Down

0 comments on commit d4a2693

Please sign in to comment.