- Issue created by @mondrake
- 🇺🇸United States mfb San Francisco
For inspiration see https://github.com/laravel/framework/tree/10.x/src/Illuminate/Database/E...
- Assigned to mondrake
- Merge request !4682Issue #3348590: Add transaction-related events to the Database API → (Open) created by mondrake
- last update
almost 2 years ago Custom Commands Failed - Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 10:53am 1 September 2023 - 🇮🇹Italy mondrake 🇮🇹
Started something, fit nicely with latest improvements in 📌 Refactor transactions Fixed . Looking forward to an early review - this sets the basis, more events are just more meat around this bone.
- last update
almost 2 years ago 30,136 pass - Status changed to Postponed
almost 2 years ago 7:47am 4 September 2023 - 🇮🇹Italy mondrake 🇮🇹
Postponed on 🐛 Strengthen TransactionManager Needs work
- Status changed to Needs work
almost 2 years ago 8:48am 14 September 2023 - Status changed to Postponed
over 1 year ago 10:11pm 19 March 2024 - 🇮🇹Italy mondrake 🇮🇹
We cannot do this now, 🐛 Transaction autocommit during shutdown relies on unreliable object destruction order Active introduced
Database::commitAllOnShutdown()
which runs at a time when the event dispatcher has been destroyed already, so events fail. One more reason to move towards explicit commit. - 🇺🇸United States mfb San Francisco
eesh, seems not-ideal to wait until most-everything is destroyed to commit transactions, i.e. difficult to respond to various transaction commit failure modes.
- 🇮🇹Italy mondrake 🇮🇹
As long as we can accept that these events are not dispatched when the event dispatcher service is not available - that is: 1) early in the request before the full container is available, and 2) during shutdown when the service can have already been destructed, this can proceed.
- 📌 [PP-1] Convert all transactions to explicit COMMIT Postponed would make this issue having some deprecated behaviour (i.e. including in the event information about the commit having occurred during destruct); however since that deprecation removal will be no sooner than D13 (2028?), I think it's worth keeping for now.
- 📌 Explore injecting the event dispatcher in the database service Active would make the event being dispatched also before full container availability - that could be a must-have if we want to move the post commit callback execution to an event-based solution.
Still needs some tests for commit/release/rollback failure events - not easy to create the context - so I will look into mocking.
But the biggest part here is already reviewable.