Imagine having an expressjs application and having an async tracking method to save in the database certain events:
class Tracking {
static async track(event) {
// saves the event in the DB
}
}
Is there some side effect or, in general, something wrong in doing something like this?
app.get('/say-hello-world', function(req, res) {
Tracking.track("say-hello-world"); // ignore Promise
console.log("HW");
Tracking.track("data-logged"); // ignore Promise
res.send('hello world');
});
The tracking code will be executed in parallel and performance should benefit from this. But is there something wrong in doing this (and not using await
)?