Async Await and Promise all

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.

  • ⏳ Number of random timeouts: 0
  • 🔄 Number of HTTP fetch requests: 0
  • 🖼️ Number of image loads: 0

⏰ Total Time taken:

Hint: Disable cache first by opening network tab in console

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%

Crop Runner Count: 0, Inserting: --, Upload Runner Count: 0, Completing: --
{
  "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
}
Hint: Disable cache first by opening network tab in console