Skip to content

Commit 113807a

Browse files
committed
do not process same event twice
1 parent 3432628 commit 113807a

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/components/Indexer/processor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function getEventProcessor(
6161
INDEXER_LOGGER.debug(
6262
'Creating new Processor for event ' + eventType + 'with key ' + cacheKey
6363
)
64-
console.log(config)
6564
processorInstances.set(cacheKey, new ProcessorClass(chainId, config))
6665
} else {
6766
INDEXER_LOGGER.debug('Reusing cached processor for key ' + cacheKey)

src/components/Indexer/processors/OrderReusedEventProcessor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ export class OrderReusedEventProcessor extends BaseEventProcessor {
4343
)
4444
return
4545
}
46+
const existingOrder = await orderDatabase.retrieve(event.transactionHash)
47+
if (existingOrder) {
48+
INDEXER_LOGGER.logMessage(
49+
`OrderReused already processed for tx ${event.transactionHash}, skipping duplicate`
50+
)
51+
return ddo
52+
}
4653
const ddoInstance = DDOManager.getDDOClass(ddo)
4754
if (!ddoInstance.getAssetFields().indexedMetadata) {
4855
ddoInstance.updateFields({ indexedMetadata: {} })

src/components/Indexer/processors/OrderStartedEventProcessor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ export class OrderStartedEventProcessor extends BaseEventProcessor {
4141
)
4242
return
4343
}
44+
const existingOrder = await orderDatabase.retrieve(event.transactionHash)
45+
if (existingOrder) {
46+
INDEXER_LOGGER.logMessage(
47+
`OrderStarted already processed for tx ${event.transactionHash}, skipping duplicate`
48+
)
49+
return ddo
50+
}
4451
const ddoInstance = DDOManager.getDDOClass(ddo)
4552
if (!ddoInstance.getAssetFields().indexedMetadata) {
4653
ddoInstance.updateFields({ indexedMetadata: {} })

0 commit comments

Comments
 (0)