Skip to content

Commit ecd22d2

Browse files
committed
Remove offset
1 parent 096bc17 commit ecd22d2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scripts/add_addresses_to_txs.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,15 @@ async def main():
2424
)
2525
limit = 100
2626

27-
offset = 0
2827
query = (
2928
select(Transaction.id, Transaction.txid)
30-
.limit(limit)
3129
.filter(Transaction.addresses == ())
3230
.limit(limit)
3331
)
3432

35-
total /= limit
33+
processed = 0
3634

37-
while txs := (await session.execute(query.offset(offset))).all():
38-
offset += limit
35+
while txs := (await session.execute(query)).all():
3936

4037
transactions_result = await make_request(
4138
settings.blockchain.endpoint,
@@ -71,8 +68,9 @@ async def main():
7168
execution_options={"synchronize_session": False},
7269
)
7370
await session.commit()
71+
processed += limit
7472
print(
75-
f"Progress: {offset // limit}/{total} ({(offset // limit/total)*100:.2f})",
73+
f"Progress: {processed}/{total} ({(processed/total)*100:.2f})",
7674
end="\r",
7775
flush=True,
7876
)

0 commit comments

Comments
 (0)