Skip to content

Commit

Permalink
Fix chunksize for little ammount of txs
Browse files Browse the repository at this point in the history
  • Loading branch information
tvorogme committed Feb 26, 2024
1 parent 6128ebd commit 0fb4782
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def finalize_options(self):

setup(
name="tonpy" if not IS_DEV else "tonpy-dev",
version="0.0.0.1.2b0" if not IS_DEV else "0.0.0.3.4a1",
version="0.0.0.1.2b0" if not IS_DEV else "0.0.0.3.4b1",
author="Disintar LLP",
author_email="[email protected]",
description="Types / API for TON blockchain",
Expand Down
6 changes: 3 additions & 3 deletions src/tonpy/blockscanner/blockscanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,14 @@ def load_historical(self):

if self.process_raw:
start_emulate_at = time()
tmp = chunks(txs, self.tx_chunk_size)
tmp = list(chunks(txs, self.tx_chunk_size))

if self.loglevel > 1:
tmp = tqdm(tmp, desc="Process raw")
tmp = tqdm(tmp, desc="Process raw", total=len(tmp))

for c in tmp:
with Pool(self.nproc) as pool:
results = pool.imap_unordered(self.f, c, chunksize=math.ceil(len(c) / self.nproc))
results = pool.imap_unordered(self.f, c, chunksize=max(200, math.ceil(len(c) / self.nproc)))

for result_chunk in results:
self.out_queue.put(result_chunk)
Expand Down
3 changes: 1 addition & 2 deletions src/tonpy/blockscanner/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class CustomSubscription:
def __init__(self):
pass
self.local_items = []

def check(self, tx: CellSlice) -> bool:
raise NotImplementedError
Expand Down Expand Up @@ -41,7 +41,6 @@ def check(self, tx: CellSlice) -> bool:
in_msg_text = in_msg_body.load_string(strict=False)
return self.text in in_msg_text
except Exception as e:
print(e)
return False

else:
Expand Down

0 comments on commit 0fb4782

Please sign in to comment.