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

Fix OrderWatcher race-condition bug #1789

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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