Skip to content

Commit

Permalink
Disable Interpreter cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bchamagne committed May 28, 2024
1 parent ae7ab2e commit 4a195be
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/archethic_playground.ex
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ defmodule ArchethicPlayground do

ArchethicPlayground.MockFunctions.prepare_mocks(mocks)

# kill JobCache from Contracts module
# necessary because the user can mock Time.now() resulting in always hitting the cache
Registry.select(Archethic.Utils.JobCacheRegistry, [{{:_, :"$1", :_}, [], [:"$1"]}])
|> Enum.each(&Process.exit(&1, :kill))

with {:ok, contract} <- parse(transaction_contract),
{:ok, _} <-
check_valid_precondition(trigger, contract, maybe_tx, maybe_recipient, datetime),
Expand All @@ -116,7 +111,8 @@ defmodule ArchethicPlayground do
maybe_tx,
maybe_recipient,
[],
time_now: datetime
time_now: datetime,
cache?: false
),
{:ok, _} <-
check_valid_postcondition(contract, next_tx, datetime),
Expand Down Expand Up @@ -165,7 +161,7 @@ defmodule ArchethicPlayground do
nil,
datetime
) do
Contracts.execute_condition(:oracle, contract, tx, nil, datetime, [])
Contracts.execute_condition(:oracle, contract, tx, nil, datetime, [], cache?: false)
end

defp check_valid_precondition(
Expand All @@ -175,7 +171,9 @@ defmodule ArchethicPlayground do
recipient,
datetime
) do
Contracts.execute_condition(condition_type, contract, tx, recipient, datetime, [])
Contracts.execute_condition(condition_type, contract, tx, recipient, datetime, [],
cache?: false
)
end

defp check_valid_precondition(_, _, _, _, _), do: {:ok, []}
Expand All @@ -185,7 +183,7 @@ defmodule ArchethicPlayground do
next_tx = %Transaction{},
datetime
) do
Contracts.execute_condition(:inherit, contract, next_tx, nil, datetime, [])
Contracts.execute_condition(:inherit, contract, next_tx, nil, datetime, [], cache?: false)
end

defp check_valid_postcondition(_, _, _), do: {:ok, []}
Expand Down

0 comments on commit 4a195be

Please sign in to comment.