Skip to content

Commit

Permalink
poap remove promise.all to ensure poi
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqiang90 committed Apr 7, 2024
1 parent 97f8a38 commit f0ff82b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Ethereum/ethereum-poap/src/mappings/mappingHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export async function handleEventToken(ev: EventTokenLog): Promise<void> {
if (token) {
token.eventId = event.id;
token.mintOrder = event.tokenMints;
await Promise.all([event.save(), token.save()]);
await event.save();
await token.save();
} else {
await event.save();
}
Expand Down Expand Up @@ -78,8 +79,11 @@ export async function handleTransfer(ev: TransferLog): Promise<void> {
blockheight: BigInt(ev.blockNumber),
});

// Save all entities in bulk
await Promise.all([token.save(), from.save(), to.save(), transfer.save()]);
// NOT use promise.all, in order to ensure generate POI in right order
await token.save();
await from.save();
await to.save();
await transfer.save();

let event: Event | undefined = undefined;
if (token.eventId) {
Expand Down

0 comments on commit f0ff82b

Please sign in to comment.