I’m writing a cloud function that makes a query and does some housekeeping:
const testFn1 = async (args) => {
try {
const results = await query(args);
update(results).then(() => console.log('update stats finished'))
return results;
} catch (e) {
console.error(e)
}
}
I have to run the query and return the result fast but also do some updates (statistics) based on this result. Updates are not crucial and can also be carried at a later time.
So the question is could this be done any better or is it ok to leave it like this?