Skip to content

fix: enable batching in mass-payout.js by deferring transfer.wait()#443

Open
Kubudak90 wants to merge 1 commit into
coinbase:masterfrom
Kubudak90:master
Open

fix: enable batching in mass-payout.js by deferring transfer.wait()#443
Kubudak90 wants to merge 1 commit into
coinbase:masterfrom
Kubudak90:master

Conversation

@Kubudak90
Copy link
Copy Markdown

Problem

The current implementation calls await transfer.wait() inside the loop, which blocks each transfer from being batched. This serializes all transfers and significantly reduces throughput.

Solution

  1. Collect all transfers in an array first (without waiting)
  2. Wait for all transfers to complete after queueing

This enables proper batching as the SDK can process multiple transfers concurrently.

Changes

  • Added transfers array to store pending transfers
  • Separated transfer creation from completion waiting
  • Improved error handling for both phases

Testing

This change maintains the same behavior while improving performance for mass payouts.

Fixes #416

The original implementation called await transfer.wait() inside the loop,
which blocked each transfer from being batched. This fix:

1. Collects all transfers in an array first
2. Waits for all transfers to complete after queueing

This enables proper batching and significantly improves performance
when processing multiple payouts.

Fixes coinbase#416
@cb-heimdall
Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

mass-payout.js (not batching?)

2 participants