Skip to content

Commit

Permalink
set OMG.State GenServer timeout to 10s (#1517)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Sullivan <[email protected]>
  • Loading branch information
achiurizo and kevsul authored Jul 24, 2020
1 parent 6be0bf2 commit 522fb32
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions apps/omg/lib/omg/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ defmodule OMG.State do

@type exec_error :: Validator.can_process_tx_error()

@timeout 10_000

### Client

@doc """
Expand All @@ -65,7 +67,7 @@ defmodule OMG.State do
{:ok, {Transaction.tx_hash(), pos_integer, non_neg_integer}}
| {:error, exec_error()}
def exec(tx, input_fees) do
GenServer.call(__MODULE__, {:exec, tx, input_fees})
GenServer.call(__MODULE__, {:exec, tx, input_fees}, @timeout)
end

@doc """
Expand All @@ -78,7 +80,7 @@ defmodule OMG.State do
"""
@spec close_block() :: {:ok, list(Core.db_update())}
def close_block() do
GenServer.call(__MODULE__, :close_block)
GenServer.call(__MODULE__, :close_block, @timeout)
end

@doc """
Expand All @@ -102,7 +104,7 @@ defmodule OMG.State do
def deposit([]), do: {:ok, []}

def deposit(deposits) do
GenServer.call(__MODULE__, {:deposit, deposits})
GenServer.call(__MODULE__, {:deposit, deposits}, @timeout)
end

@doc """
Expand All @@ -119,15 +121,15 @@ defmodule OMG.State do
def exit_utxos([]), do: {:ok, [], {[], []}}

def exit_utxos(exiting_utxo_triggers) do
GenServer.call(__MODULE__, {:exit_utxos, exiting_utxo_triggers})
GenServer.call(__MODULE__, {:exit_utxos, exiting_utxo_triggers}, @timeout)
end

@doc """
Provides a peek into the UTXO set to check if particular output exist (have not been spent)
"""
@spec utxo_exists?(Utxo.Position.t()) :: boolean()
def utxo_exists?(utxo) do
GenServer.call(__MODULE__, {:utxo_exists, utxo})
GenServer.call(__MODULE__, {:utxo_exists, utxo}, @timeout)
end

@doc """
Expand All @@ -138,7 +140,7 @@ defmodule OMG.State do
"""
@spec get_status() :: {non_neg_integer(), boolean()}
def get_status() do
GenServer.call(__MODULE__, :get_status)
GenServer.call(__MODULE__, :get_status, @timeout)
end

### Server
Expand Down

0 comments on commit 522fb32

Please sign in to comment.