You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some plugins using ShippingCalculator that are promises. Would be nice to all promises were loaded at the same time. Currently, the method getEligibleShippingMethods awaits the response from the shippingMethods individually.
The text was updated successfully, but these errors were encountered:
jonyw4
changed the title
Await all promises in the same time with ShippingCalculator
Await all promises in the same time in method getEligibleShippingMethods in ShippingCalculator
Jul 3, 2020
Good point, we can parallelize both the test and the apply steps here.
To solve the problem I created checkEligibilityByShippingMethod. This function waits for test and apply. So in getEligibleShippingMethods we can make an array of many checkEligibilityByShippingMethod, and then create a Promise.all with everything at the same time.
How apply depends on the response from test I put these two in the same function and apply await for test.
* feat(core): Accept empty as response in shipping calculator
* feat(core): Await all promises at same time in ShippingCalculator
* refactor(core): Update filter undefined shipping calculator
Closes#397, closes#398
I have some plugins using ShippingCalculator that are promises. Would be nice to all promises were loaded at the same time. Currently, the method
getEligibleShippingMethods
awaits the response from theshippingMethods
individually.vendure/packages/core/src/service/helpers/shipping-calculator/shipping-calculator.ts
Lines 17 to 32 in b2f3f08
A solution would be using Promises.all.
The text was updated successfully, but these errors were encountered: