diff --git a/.gitignore b/.gitignore index ae4c7c37..4048883b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ erl_crash.dump tmp config/secret.exs .DS_Store +.tool-versions diff --git a/lib/new_relic/harvest/harvest_cycle.ex b/lib/new_relic/harvest/harvest_cycle.ex index a27818d6..34e1c84e 100644 --- a/lib/new_relic/harvest/harvest_cycle.ex +++ b/lib/new_relic/harvest/harvest_cycle.ex @@ -131,13 +131,22 @@ defmodule NewRelic.Harvest.HarvestCycle do :exit, _exit -> NewRelic.log(:error, "Failed to send harvest from #{inspect(supervisor)}") after - DynamicSupervisor.terminate_child(supervisor, harvester) + terminate_child(supervisor, harvester) end end, shutdown: @harvest_timeout ) end + defp terminate_child(supervisor, harvester) do + try do + DynamicSupervisor.terminate_child(supervisor, harvester) + catch + :exit, _exit -> + :ok + end + end + defp stop_harvest_cycle(timer), do: timer && Process.cancel_timer(timer) defp trigger_harvest_cycle(%{