-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: validate bids order #124
Conversation
3c3d24b
to
b66ab4c
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
return nonceResults.reduce((acc, { bidder, nonce, isNonceUsed }) => { | ||
acc[`${bidder}-${nonce}`] = isNonceUsed | ||
return acc | ||
}, {} as { [key: string]: boolean }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question from my javascript ignorance: do we need to give {} as { [key : string]: boolean} for the initial value of the accumulator or could we just give empty array for the reduce?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we are dealing with objects, so need to give empty object ie {}. if it'd have been an array, then empty array would have worked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense but would it work if we just gave it {} like
return nonceResults.reduce((acc, { bidder, nonce, isNonceUsed }) => {
acc[`${bidder}-${nonce}`] = isNonceUsed
return acc
}, {})
Task:
Fix "validate bids" order
Description
Using Promise.all doesn't guarantee the order in which the promises are going to be resolved. Whichever gets the response first, gets resolved first. As a result of that, the value of filledAmt was getting increased in a random order.
We made this change to incorporate async nonce checks.
Fix is to separately get the nonce check and then synchronously filter the bids in the order that they are supposed to.
Fixes ENG-2045
Type of change