Skip to content

Commit

Permalink
fix: airdrops in series (#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncomerci authored and 1emu committed Sep 11, 2023
1 parent b03a322 commit 954d57c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/services/BadgesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ export class BadgesService {
landOwnerAddresses
)

const outcomes = await Promise.all(
splitArray([...eligibleUsers, ...usersWithBadgesToReinstate], 20).map((addresses) =>
BadgesService.giveBadgeToUsers(LAND_OWNER_BADGE_SPEC_CID, addresses)
)
)
const outcomes: AirdropOutcome[] = []
const batches = splitArray([...eligibleUsers, ...usersWithBadgesToReinstate], 50)

for (const batch of batches) {
const outcome = await BadgesService.giveBadgeToUsers(LAND_OWNER_BADGE_SPEC_CID, batch)
outcomes.push(outcome)
}

const failedOutcomes = outcomes.filter(
({ status, error }) =>
status === AirdropJobStatus.FAILED &&
Expand Down

0 comments on commit 954d57c

Please sign in to comment.