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 committed Sep 6, 2023
1 parent 1ce25b8 commit 4658d53
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 4658d53

Please sign in to comment.