Skip to content

Feature Request: Know the origin of an event (historical or live indexing) #562

Description

@Segfaultd

Introduction

Due to iterative development, we have to trigger re-indexing almost every weeks. Our code is linked to Kafka and that means that each re-indexing will spam our Kafka with "useless" messages, in the sense that they are historical and not interesting for live listening to events.

Proposed solution

Would be the great to be able to know from the event params in the handlers if the event comes from historical or live indexation.

Here is a sample of what it would look like:

UniswapV4Pool.Swap.handler(async ({ event, context }) => {
    const poolState = await getV4PoolState(event.srcAddress as Address);
    if(!poolState){
        return;
    }

    await insertOrUpdateV4Pool(context, event.srcAddress as Address, poolState, { eventBlockNumber: event.block.number, eventBlockTimestamp: event.block.timestamp });

    if(event.origin == EventOrigin.Live){
        broadcastToKafka(event);
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions