From 80fa295d842c439d0734fa0b51b03054d0a98f44 Mon Sep 17 00:00:00 2001 From: sl1depengwyn Date: Fri, 17 Feb 2023 20:49:17 +0300 Subject: [PATCH] Extend `INDEXER_MEMORY_LIMIT` env parsing --- CHANGELOG.md | 1 + config/runtime.exs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e128affc9..6391d597f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ### Chore +- [#6929](https://github.com/blockscout/blockscout/pull/6929) - Extend `INDEXER_MEMORY_LIMIT` env parsing - [#6902](https://github.com/blockscout/blockscout/pull/6902) - Increase verification timeout to 120 seconds for microservice verification
diff --git a/config/runtime.exs b/config/runtime.exs index 478d652968..cd785631fc 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -7,14 +7,16 @@ indexer_memory_limit_default = 1 indexer_memory_limit = "INDEXER_MEMORY_LIMIT" |> System.get_env(to_string(indexer_memory_limit_default)) + |> String.downcase() |> Integer.parse() |> case do - {integer, ""} -> integer - _ -> indexer_memory_limit_default + {integer, g} when g in ["g", "gb", ""] -> integer <<< 30 + {integer, m} when m in ["m", "mb"] -> integer <<< 20 + _ -> indexer_memory_limit_default <<< 30 end config :indexer, - memory_limit: indexer_memory_limit <<< 30 + memory_limit: indexer_memory_limit indexer_empty_blocks_sanitizer_batch_size_default = 100