From f06787fd7fc0a4d60a3f1e2bbb0a6938219e4b80 Mon Sep 17 00:00:00 2001 From: goodsoft Date: Sun, 10 Mar 2019 21:50:42 +0200 Subject: [PATCH] Fix scheduling of latest block polling in Realtime Fetcher Timer is set using Elixir's `Process.send_after/3` method, which is incompatible with Erlang's `:timer` module. Thus, `:timer.cancel` doesn't have any effect on it, and in fact returns `{:error, :badarg}`. This causes more and more polling being scheduled after every websocket event, which might cause excessive flooding of a node with `eth_getBlockByNumber` requests after some running time. --- apps/indexer/lib/indexer/block/realtime/fetcher.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/indexer/lib/indexer/block/realtime/fetcher.ex b/apps/indexer/lib/indexer/block/realtime/fetcher.ex index 61def67c82..dcf4ecb4bd 100644 --- a/apps/indexer/lib/indexer/block/realtime/fetcher.ex +++ b/apps/indexer/lib/indexer/block/realtime/fetcher.ex @@ -96,7 +96,7 @@ defmodule Indexer.Block.Realtime.Fetcher do new_max_number = new_max_number(number, max_number_seen) - :timer.cancel(timer) + Process.cancel_timer(timer) new_timer = schedule_polling() {:noreply,