From 4a195be75eb7853118f57e61ce54b1ec43f34785 Mon Sep 17 00:00:00 2001 From: bchamagne Date: Tue, 28 May 2024 16:00:15 +0200 Subject: [PATCH] Disable Interpreter cache --- lib/archethic_playground.ex | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/archethic_playground.ex b/lib/archethic_playground.ex index 659e205..e1edd15 100644 --- a/lib/archethic_playground.ex +++ b/lib/archethic_playground.ex @@ -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), @@ -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), @@ -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( @@ -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, []} @@ -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, []}