chore: Reverse internal transactions fetching order (#10912)

* chore: Reverse internal transactions fetching order

* Add env var for internal transactions fetching order
production-redstone
Qwerty5Uiop 1 month ago committed by GitHub
parent 6042b40b07
commit 7d763c0cbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      apps/explorer/lib/explorer/chain.ex
  2. 4
      config/runtime.exs
  3. 1
      docker-compose/envs/common-blockscout.env

@ -1899,12 +1899,14 @@ defmodule Explorer.Chain do
when accumulator: term()
def stream_blocks_with_unfetched_internal_transactions(initial, reducer, limited? \\ false)
when is_function(reducer, 2) do
direction = Application.get_env(:indexer, :internal_transactions_fetch_order)
query =
from(
po in PendingBlockOperation,
where: not is_nil(po.block_number),
select: po.block_number,
order_by: [desc: po.block_number]
order_by: [{^direction, po.block_number}]
)
query

@ -681,7 +681,9 @@ config :indexer,
ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 100_000),
coin_balances_fetcher_init_limit:
ConfigHelper.parse_integer_env_var("INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 2000),
graceful_shutdown_period: ConfigHelper.parse_time_env_var("INDEXER_GRACEFUL_SHUTDOWN_PERIOD", "5m")
graceful_shutdown_period: ConfigHelper.parse_time_env_var("INDEXER_GRACEFUL_SHUTDOWN_PERIOD", "5m"),
internal_transactions_fetch_order:
ConfigHelper.parse_catalog_value("INDEXER_INTERNAL_TRANSACTIONS_FETCH_ORDER", ["asc", "desc"], true, "asc")
config :indexer, :ipfs,
gateway_url: System.get_env("IPFS_GATEWAY_URL", "https://ipfs.io/ipfs"),

@ -279,6 +279,7 @@ INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT=
# INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT=
# INDEXER_GRACEFUL_SHUTDOWN_PERIOD=
# INDEXER_INTERNAL_TRANSACTIONS_FETCH_ORDER=
# WITHDRAWALS_FIRST_BLOCK=
# INDEXER_OPTIMISM_L1_RPC=
# INDEXER_OPTIMISM_L1_SYSTEM_CONFIG_CONTRACT=

Loading…
Cancel
Save