Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1789 from 0xProject/fix/order-watcher-race-condition
Browse files Browse the repository at this point in the history
Fix OrderWatcher race-condition bug
  • Loading branch information
fabioberger authored Apr 24, 2019
2 parents 509fabb + cc3378b commit 18acf50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/order-watcher/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "4.0.7",
"changes": [
{
"note": "Fix race-condition bug due to async callback modifying shared state",
"pr": 1789
}
]
},
{
"version": "4.0.6",
"changes": [
Expand Down
3 changes: 3 additions & 0 deletions packages/order-watcher/src/order_watcher/order_watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ export class OrderWatcher {
private async _emitRevalidateOrdersAsync(orderHashes: string[], transactionHash?: string): Promise<void> {
for (const orderHash of orderHashes) {
const signedOrder = this._orderByOrderHash[orderHash];
if (signedOrder === undefined) {
continue;
}
// Most of these calls will never reach the network because the data is fetched from stores
// and only updated when cache is invalidated
const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash);
Expand Down

0 comments on commit 18acf50

Please sign in to comment.