Closed fahhem closed 8 months ago
The previous code assumed tx.finish
was set, even though it's set in a doubly-nested callback that requires:
env.db.api.transaction
must initiateenv.rules.isOperationAllowed
must return without an errornew Promise
must be scheduled and runAll the while, the timeout for finishing/canceling has already started. I'm not 100% certain, but that seems to be 3 or more round-trips through the scheduler and possibly many javascript executions to run the rules. That means if you have enough rules and the server is busy enough, the transaction will never start
@fahhem Merged! Thanks a lot for contributing and for clarifying, I'll take a look if I can improve this
Hi @fahhem I'm happy to merge if you can please describe when this happens? Also, please use the shorter syntax
tx.finish?.()
And apologies for this late reply!