Sfoglia il codice sorgente

fix(core): Fix floating promise & missed eventBus (#2779)

Yingchun Tian 1 anno fa
parent
commit
603a36ec78
1 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 2 3
      packages/core/src/config/order/default-order-process.ts

+ 2 - 3
packages/core/src/config/order/default-order-process.ts

@@ -415,13 +415,12 @@ export function configureDefaultOrderProcess(options: DefaultOrderProcessOptions
                     await Promise.all(
                         order.lines.map(line => {
                             line.orderPlacedQuantity = line.quantity;
-                            connection
+                            return connection
                                 .getRepository(ctx, OrderLine)
                                 .update(line.id, { orderPlacedQuantity: line.quantity });
-                            return line;
                         }),
                     );
-                    eventBus.publish(new OrderPlacedEvent(fromState, toState, ctx, order));
+                    await eventBus.publish(new OrderPlacedEvent(fromState, toState, ctx, order));
                     await orderSplitter.createSellerOrders(ctx, order);
                 }
             }