Skip to content

Commit

Permalink
Remove delete user in OrderSubscriber on filled. (drift-labs#1245)
Browse files Browse the repository at this point in the history
This can be problematic if account updates are received out of order, or `tryUpdateUserAccount` is invoked out of order.
If an account update for a slot `t-1` is received for an order filled at slot `t`, then the `OrderSubscriber` will
erroneously report the open order.
  • Loading branch information
wphan authored Oct 8, 2024
1 parent 5e78b1d commit f187414
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sdk/src/orderSubscriber/OrderSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,8 @@ export class OrderSubscriber {
dataType
);
}
if (userAccount.hasOpenOrder) {
this.usersAccounts.set(key, { slot, userAccount });
} else {
this.usersAccounts.delete(key);
}

this.usersAccounts.set(key, { slot, userAccount });
}
}

Expand Down

0 comments on commit f187414

Please sign in to comment.