Demo 1 - This shows how a Promise.all
can be used on a load of async await functions chained together... the total time taken will be displayed once all have finished.
⏰ Total Time taken:
Demo 2 - In this next demo we are making use of Promise.allSettled
in order to repeat processing until all of them are settled - for this demo the failure rate has been set exceptionally high at 99.5% - in the real-world this would be much lower but its useful to see it working in this quick demo!
We are simulating running a process that crops images, and then uploads them.
Fail Rate: 99.5%
{ "crops": { "frame_1": { "32px": false, "128px": false, "400px": false, "color1x1": false }, "frame_2": { "32px": false, "128px": false, "400px": false }, "frame_3": { "32px": false, "128px": false, "400px": false }, "frame_4": { "32px": false, "128px": false, "400px": false }, "frame_5": { "32px": false, "128px": false, "400px": false } }, "insert": false, "uploads": { "frame_1": { "32px": false, "128px": false, "400px": false, "original": false }, "frame_2": { "32px": false, "128px": false, "400px": false }, "frame_3": { "32px": false, "128px": false, "400px": false }, "frame_4": { "32px": false, "128px": false, "400px": false }, "frame_5": { "32px": false, "128px": false, "400px": false } }, "complete": false }