From 36d76bb6f796380029dfd41e0b8a73fbe9d884d6 Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Thu, 6 May 2021 19:19:55 +0300 Subject: [PATCH] Set token_id together with token_contract_hash in group_by, oreder statements (cherry picked from commit 0d9769717a9bce4e7a49599b9146f78cdd4d27e2) --- .../lib/explorer/chain/import/runner/blocks.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/import/runner/blocks.ex b/apps/explorer/lib/explorer/chain/import/runner/blocks.ex index 1abbf05932..58ceecf06b 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/blocks.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/blocks.ex @@ -345,8 +345,8 @@ defmodule Explorer.Chain.Import.Runner.Blocks do # Enforce TokenBalance ShareLocks order (see docs: sharelocks.md) order_by: [ tb.token_contract_address_hash, - tb.address_hash, tb.token_id, + tb.address_hash, tb.block_number ], lock: "FOR UPDATE" @@ -383,8 +383,8 @@ defmodule Explorer.Chain.Import.Runner.Blocks do # Enforce CurrentTokenBalance ShareLocks order (see docs: sharelocks.md) order_by: [ ctb.token_contract_address_hash, - ctb.address_hash, - ctb.token_id + ctb.token_id, + ctb.address_hash ], lock: "FOR UPDATE" ) @@ -477,7 +477,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do # Enforce CurrentTokenBalance ShareLocks order (see docs: sharelocks.md) |> Enum.sort_by(&{&1.token_contract_address_hash, &1.address_hash}) - {_total, result_with_token_id} = + {_total, result_no_token_id} = repo.insert_all( Address.CurrentTokenBalance, ordered_current_token_balance_no_token_id, @@ -494,7 +494,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do # Enforce CurrentTokenBalance ShareLocks order (see docs: sharelocks.md) |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id, &1.address_hash}) - {_total, result_no_token_id} = + {_total, result_with_token_id} = repo.insert_all( Address.CurrentTokenBalance, ordered_current_token_balance_with_token_id,