Skip to content

Commit

Permalink
fix the crash when gc_interval is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
dongfuye committed Jan 13, 2023
1 parent 53e570d commit df4cb29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/nebulex/adapters/local/generation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,12 @@ defmodule Nebulex.Adapters.Local.Generation do
Metadata.put(meta_tab, :deprecated, older)
end

defp start_timer(time, ref \\ nil, event \\ :heartbeat) do
_ = if ref, do: Process.cancel_timer(ref)
defp start_timer(time, ref \\ nil, event \\ :heartbeat)

defp start_timer(:nil, _, _), do: nil

defp start_timer(time, ref, event) do
_ = if ref, do: Process.cancel_timer(ref)
Process.send_after(self(), event, time)
end

Expand Down

0 comments on commit df4cb29

Please sign in to comment.