As a consequence of this problem, in my observability changes I have to invoke await this.begin() so as to ensure proper span production but @surbhigarg raised a point in a code review with
Can we hold on this change of making 'error' event async. I know this would mean that our few spans wont work correctly.
I am working on another PR to see if this check can be removed #2168
Adding async here will cause other issues like in below when runTransactionAsync method tries to insert an invalid error, normally this error event is invoked first and then catch block. But if you add async here, this would make catch block invoked first as error event is called asynchronously which will cause other issues.
try {
await database.runTransactionAsync(async transaction => {
await transaction.run(
"INSERT INTO Singers (SingerId, FirstName) VALUES (310, 'abc')"
);
await transaction.commit();
});
await database.runTransactionAsync(async transaction => {
await transaction.run(
"INSERT INTO Singers (SingerId, FirstName) VALUES (310, 'abc')"
);
await transaction.commit();
});
} catch (err) {
console.error('ERROR:', err);
// throw err;
} finally {
database.close();
}
Remove this change and add a bug where we mention what scenarios are not working and I will take it up separately.
Originally posted by @surbhigarg92 in #2158 (comment)