Skip to content
Snippets Groups Projects
Commit 8a58957b authored by Mariusz Trela's avatar Mariusz Trela Committed by Mariusz Trela
Browse files

Slowdown fix - part 2

parent a8d03c5b
No related branches found
No related tags found
4 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!61Issue #47 - test database_api get_payout_stats fail
......@@ -101,9 +101,10 @@ class Blocks:
return cls.ops_stats
@staticmethod
def prepare_vops( comment_payout_ops, vopsList, date):
def prepare_vops(vopsList, date):
vote_ops = {}
comment_payout_ops = {}
ops_stats = { 'author_reward_operation' : 0, 'comment_reward_operation' : 0, 'effective_comment_vote_operation' : 0, 'comment_payout_update_operation' : 0 }
for vop in vopsList:
......@@ -151,7 +152,7 @@ class Blocks:
comment_payout_ops[key][op_type] = op_value
return (vote_ops, ops_stats)
return (vote_ops, comment_payout_ops, ops_stats)
@classmethod
......@@ -235,21 +236,26 @@ class Blocks:
cls.ops_stats = Blocks.merge_ops_stats(cls.ops_stats, custom_ops_stats)
# virtual ops
comment_payout_stats = {}
comment_payout_ops = {}
vote_ops = {}
comment_payout_stats = {}
empty_vops = (vote_ops, comment_payout_stats)
empty_vops = (vote_ops, comment_payout_ops, comment_payout_stats)
if is_initial_sync:
(vote_ops, comment_payout_stats) = virtual_operations[num] if num in virtual_operations else empty_vops
(vote_ops, comment_payout_ops, comment_payout_stats) = virtual_operations[num] if num in virtual_operations else empty_vops
else:
vops = hived.get_virtual_operations(num)
(vote_ops, comment_payout_stats) = Blocks.prepare_vops(Posts.comment_payout_ops, vops, cls._head_block_date)
cls.ops_stats = Blocks.merge_ops_stats(cls.ops_stats, comment_payout_stats)
(vote_ops, comment_payout_ops, comment_payout_stats) = Blocks.prepare_vops(vops, cls._head_block_date)
cls.comment_payout_ops = {**Posts.comment_payout_ops, **comment_payout_ops}
for k, v in vote_ops.items():
Votes.effective_comment_vote_op(v, cls._head_block_date)
if comment_payout_ops:
cls.ops_stats = Blocks.merge_ops_stats(cls.ops_stats, comment_payout_stats)
cls._head_block_date = block_date
return num
......
......@@ -19,7 +19,6 @@ from hive.db.db_state import DbState
from hive.utils.timer import Timer
from hive.steem.block.stream import MicroForkException
from hive.indexer.posts import Posts
from hive.indexer.blocks import Blocks
from hive.indexer.accounts import Accounts
from hive.indexer.feed_cache import FeedCache
......@@ -46,7 +45,7 @@ def prepare_vops(vops_by_block):
for blockNum, blockDict in vops_by_block.items():
vopsList = blockDict['ops']
date = blockDict['timestamp']
preparedVops[blockNum] = Blocks.prepare_vops(Posts.comment_payout_ops, vopsList, date)
preparedVops[blockNum] = Blocks.prepare_vops(vopsList, date)
return preparedVops
......
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