Skip to content

Contract Subscriber Tries to Process Same Block #41

Description

@lightclient

If no new events occur between iterations of the contract subscriber loop, it will process the same block over and over again.

let fromBlock = await getAsync('currentBlock') || 0;
let events = await StandardBounties.getPastEvents({fromBlock, toBlock: 'latest'});
let eventBlock = await sendEvents(events);
if (eventBlock) {
await writeAsync('currentBlock', eventBlock);
}

I think that eventBlock should be incremented by 1 before updating the currentBlock in the Redis cache. This is a minor issue since messageDeduplicationId should stop it from actually getting processed, however it seems like it puts unnecessary strain on the cache.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions