Skip to content

Commit

Permalink
Merge branch 'hotfix/23.09-hotfix8'
Browse files Browse the repository at this point in the history
  • Loading branch information
myrho committed Nov 16, 2023
2 parents f8b6371 + d540b8f commit b97abbe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gsrest/db/cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,34 +1025,31 @@ async def list_links(self,

fetch_size = min(pagesize or SMALL_PAGE_SIZE, SMALL_PAGE_SIZE)
paging_state = from_hex(page)
has_more_pages = True
count = 0
links = dict()
tx_ids = []
while count < fetch_size and has_more_pages:
while len(tx_ids) < fetch_size:
results1 = await self.execute_async(
currency,
'transformed',
first_query, [first_id_group, first_id, isOutgoing],
paging_state=paging_state,
fetch_size=fetch_size)
fetch_size=None)

if not results1.current_rows:
return [], None
break

paging_state = results1.paging_state
has_more_pages = paging_state is not None

params = \
[[second_id_group, second_id, not isOutgoing, row['tx_id']]
for row in results1.current_rows]
results2 = await self.concurrent_with_args(currency, 'transformed',
second_query, params)

for row in results2:
fs = fetch_size - len(tx_ids)
for row in results2[:fs]:
index = row['tx_id']
tx_ids.append(index)
count += 1
links[index] = dict()
links[index][second_value] = row['value']
for row in results1.current_rows:
Expand All @@ -1061,6 +1058,9 @@ async def list_links(self,
continue
links[index][first_value] = row['value']

if paging_state is None:
break

for row in await self.list_txs_by_ids(currency, tx_ids):
links[row['tx_id']]['tx_hash'] = row['tx_hash']
links[row['tx_id']]['height'] = row['block_id']
Expand Down

0 comments on commit b97abbe

Please sign in to comment.