Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: deleteOrFail() open transaction internally and at the moment transaction is opened but it is never closed. #33

Closed
dimitriBouteille opened this issue Mar 8, 2024 · 3 comments · Fixed by #94
Assignees
Labels
bug Something isn't working ready to deploy v4
Milestone

Comments

@dimitriBouteille
Copy link
Owner

dimitriBouteille commented Mar 8, 2024

#17 (comment)


@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.

@maxrice
Copy link

maxrice commented Sep 9, 2024

Seeing this same issue with updateOrFail() as well — the transaction is started but never commits.

@dimitriBouteille dimitriBouteille added this to the 3.3.0 milestone Sep 9, 2024
@dimitriBouteille dimitriBouteille modified the milestones: 3.3.0, 4.x.x Sep 9, 2024
@dimitriBouteille
Copy link
Owner Author

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,

@dimitriBouteille
Copy link
Owner Author

dimitriBouteille commented Oct 13, 2024

Hi @maxrice and @mrmoric

The issue is fixed and will be available in next major version (v4). You can find more details here: #94

I let you re-open the issue if there is still a bug :)

Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready to deploy v4
Projects
None yet
2 participants