|
|
@ -47,10 +47,16 @@ defmodule Indexer.Memory.Monitor do |
|
|
|
|
|
|
|
|
|
|
|
@impl GenServer |
|
|
|
@impl GenServer |
|
|
|
def init(options) when is_map(options) do |
|
|
|
def init(options) when is_map(options) do |
|
|
|
state = struct!(__MODULE__, Map.put_new(options, :limit, define_memory_limit())) |
|
|
|
case Application.get_env(:explorer, :mode) do |
|
|
|
{:ok, timer_reference} = :timer.send_interval(state.timer_interval, :check) |
|
|
|
: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 |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@impl GenServer |
|
|
|
@impl GenServer |
|
|
|