Created
May 4, 2020 09:58
-
-
Save Aschen/52ff5e929150f97c89d8ad5eaa840968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { AsyncLocalStorage } = require('async_hooks'); | |
const asyncLocalStorage = new AsyncLocalStorage(); | |
app.get('/', (request, response) => { | |
const requestId = uuid(); | |
asyncLocalStorage.run(requestId, async () => { | |
// entering asynchronous context | |
log('Start processing'); | |
await emailService.notify(request.body.emails); | |
response.writeHead(200); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment