wp-orm
wp-orm copied to clipboard
[BUG]: deleteOrFail() open transaction internally and at the moment transaction is opened but it is never closed.
https://github.com/dimitriBouteille/wp-orm/issues/17#issuecomment-1980829026
@dimitriBouteille one more thing, deleteOrFail() open transaction internally and at the moment transaction is opened but it is never closed.
public function deleteOrFail()
{
if (! $this->exists) {
return false;
}
return $this->getConnection()->transaction(function () {
return $this->delete();
});
}
In the query log, I see only: "[06-Mar-2024 12:55:51 UTC] START TRANSACTION;" and that's it.
It looks like WordPress can be launched with different type of tables: InnoDB, MyISAM, etc.
InnoDB tables are transactional tables. Non-transactional tables would be e.g MyISAM.
Please check that code is working good with transactional table and non-transactional ones. If it's running with non-transactional table, it shouldn't try to create the transaction.
I think need to add a couple of unit tests.
Seeing this same issue with updateOrFail() as well — the transaction is started but never commits.
Hi @maxrice
I will not be able to fix the bug on the 3.x, I plan to fix this bug on the next major release: 4.0.0.
Best,
Hi @maxrice and @mrmoric
The issue is fixed and will be available in next major version (v4). You can find more details here: https://github.com/dimitriBouteille/wp-orm/pull/94
I let you re-open the issue if there is still a bug :)
Best