fastify.get('/async-block-event-loop', async (_request, reply) => { const hash = crypto.createHash('sha256'); const numberOfHasUpdates = 10e6; const updatehashAsync = async () => { hash.update(randomString()); }; for (let iter = 0; iter < numberOfHasUpdates; iter++) { await updatehashAsync(); } reply.send({ data: 'Finished long process' }); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter