class ElasticAPM::Transport::Base

def ensure_watcher_running

def ensure_watcher_running
  # pid has changed == we've forked
  return if @pid == Process.pid
  @watcher_mutex.synchronize do
    return if @pid == Process.pid
    @pid = Process.pid
    @watcher = Concurrent::TimerTask.execute(
      execution_interval: WATCHER_EXECUTION_INTERVAL,
      timeout_interval: WATCHER_TIMEOUT_INTERVAL
    ) { ensure_worker_count }
  end
end