Skip to content

Processor syncing fix (blocksWithEvents)#521

Merged
zeeshanakram3 merged 2 commits intoJoystream:masterfrom
Lezek123:fix_519
Apr 6, 2023
Merged

Processor syncing fix (blocksWithEvents)#521
zeeshanakram3 merged 2 commits intoJoystream:masterfrom
Lezek123:fix_519

Conversation

@Lezek123
Copy link
Copy Markdown

@Lezek123 Lezek123 commented Apr 3, 2023

Fixes #519

blocksWithEvents AsyncGenerator was not properly awaiting the promise returned by pWaitFor. This promise was supposed to stop the generator from yeilding next block until all evens emitted in that block were fetched from the indexer.

Becasue it was not properly awaited, it was possible for the blocksWithEvents to yeild a block with an incomplete array of events in case the indexer was responsing to requests more slowly than usual.

As a result, the processor would think it processed a full block and update the last_scanned_block value in the database, while not actually processing all events from that block. This is the scenario that has caused issues such as #519

Lezek123 added 2 commits April 3, 2023 21:42
affects: @joystream/hydra-cli, @joystream/hydra-processor

\`blocksWithEvents\` \`AsyncGenerator\` was not properly awaiting the promise returned by
\`pWaitFor\`.
This promise was supposed to stop the generator from yeilding next block
until all
evens emitted in that block were fetched from the indexer.
Becasue it was not properly awaited,
it
was possible for the \`blocksWithEvents\` to yeild a block with an incomplete array of events
in case
the indexer was responsing to requests more slowly than usual.
As a result, the processor would
think it processed a full block
and update the \`last_scanned_block\` value in the database,
while not
actually processing all events in that block.
This is the scenario that has caused issues such as
Joystream#519

ISSUES CLOSED: Joystream#519
@zeeshanakram3 zeeshanakram3 self-requested a review April 5, 2023 08:50
Copy link
Copy Markdown
Contributor

@zeeshanakram3 zeeshanakram3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: hydra might skip processing some events when hydra crashes unexpectedly processing a block and then start from the next block

2 participants