From 9b943cc9ddbf35224b4a75b676f256220ab7c627 Mon Sep 17 00:00:00 2001 From: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:25:17 +0400 Subject: [PATCH] fix: Indexer memory limit for api instance (#11066) --- apps/indexer/lib/indexer/memory/monitor.ex | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/indexer/lib/indexer/memory/monitor.ex b/apps/indexer/lib/indexer/memory/monitor.ex index c4032f7632..225428af11 100644 --- a/apps/indexer/lib/indexer/memory/monitor.ex +++ b/apps/indexer/lib/indexer/memory/monitor.ex @@ -47,10 +47,16 @@ defmodule Indexer.Memory.Monitor do @impl GenServer def init(options) when is_map(options) do - state = struct!(__MODULE__, Map.put_new(options, :limit, define_memory_limit())) - {:ok, timer_reference} = :timer.send_interval(state.timer_interval, :check) + case Application.get_env(:explorer, :mode) do + :api -> + :ignore - {:ok, %__MODULE__{state | timer_reference: timer_reference}} + _other_mode -> + state = struct!(__MODULE__, Map.put_new(options, :limit, define_memory_limit())) + {:ok, timer_reference} = :timer.send_interval(state.timer_interval, :check) + + {:ok, %__MODULE__{state | timer_reference: timer_reference}} + end end @impl GenServer