Skip to content
Snippets Groups Projects
Commit 5e922bc3 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

Fix for getting vops timeout. Vops are read in 100 blocks chunks and then joined.

parent dc255c15
No related branches found
No related tags found
5 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!16Dk issue 3 concurrent block query rebase,!15Dk issue 3 concurrent block query
...@@ -155,16 +155,26 @@ class SteemClient: ...@@ -155,16 +155,26 @@ class SteemClient:
def enum_virtual_ops(self, begin_block, end_block): def enum_virtual_ops(self, begin_block, end_block):
""" Get virtual ops for range of blocks """ """ Get virtual ops for range of blocks """
result = self.__exec('enum_virtual_ops', {"block_range_begin":begin_block, "block_range_end":end_block})
ops = result['ops'] if 'ops' in result else []
tracked_ops = ['curation_reward_operation', 'author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation']
ret = {} ret = {}
for op in ops: delta = 100
block = op['block']
if block in ret and op['op']['type'] in tracked_ops: from_block = begin_block
ret[block]['ops'].append(op['op']) to_block = (begin_block + delta) if begin_block + delta < end_block else end_block
if block not in ret and op['op']['type'] in tracked_ops:
ret[block] = {'timestamp':op['timestamp'], 'ops':[op['op']]} while from_block < to_block:
print("From: ", from_block, " To: ", to_block)
result = self.__exec('enum_virtual_ops', {"block_range_begin":from_block, "block_range_end":to_block})
ops = result['ops'] if 'ops' in result else []
tracked_ops = ['curation_reward_operation', 'author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation']
for op in ops:
block = op['block']
if block in ret and op['op']['type'] in tracked_ops:
ret[block]['ops'].append(op['op'])
if block not in ret and op['op']['type'] in tracked_ops:
ret[block] = {'timestamp':op['timestamp'], 'ops':[op['op']]}
from_block = to_block
to_block = (from_block + delta) if from_block + delta < end_block else end_block
return ret return ret
def get_comment_pending_payouts(self, comments): def get_comment_pending_payouts(self, comments):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment