Skip to content

Commit 198db3c

Browse files
authored
Merge pull request #1407 from numbersprotocol/fix-order-history-creation-race-condition
fix(actions.page.ts): only create a order history record if the total…
2 parents 5845d91 + 64382fd commit 198db3c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/app/features/home/details/actions/actions.page.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,19 @@ export class ActionsPage {
142142
concatMap(orderId =>
143143
this.blockingActionService.run$(this.confirmOrder$(orderId))
144144
),
145-
tap(networkAppOrder =>
146-
this.createOrderHistory$(networkAppOrder).subscribe()
147-
),
145+
tap(networkAppOrder => {
146+
/*
147+
Workaround:
148+
Create a order history record only if the total cost is > 0 to prevent race condition
149+
between app creating the order history record v.s. bubble workflow checking whether a
150+
record already exists and if not create a new one, especially for network actions that
151+
don't require any cost (and hence backend calls the webhook immediately). See
152+
https://dt42-numbers.slack.com/archives/C0323488MEJ/p1648006014291339
153+
*/
154+
if (Number(networkAppOrder.total_cost) !== 0) {
155+
this.createOrderHistory$(networkAppOrder).subscribe();
156+
}
157+
}),
148158
tap(() => {
149159
this.snackBar.open(
150160
this.translocoService.translate('message.sentSuccessfully')

0 commit comments

Comments
 (0)