-
Notifications
You must be signed in to change notification settings - Fork 470
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
This package is not concurrency safe #503
Comments
Would be great if this is getting done. We currently have a lot of Deadlock issues:
|
@lazychaser what do you think about this issue? This issue affects all users. |
Please use other locking mechanics like RedLock when performing updates on nodes to avoid dead locks. |
Does someone have a patch for this ? |
Can this be workaround? At least for broken trees, not deadlocks. Laravel Command that runs every minute or more often (latest Laravel supports Sub-minute Scheduling) class FixTree extends Command
{
public function handle()
{
if(!Category::isBroken()) {
return;
}
Category::fixTree();
}
} |
Because this package relies on calculations on the code side, the tree will always be in a broken state when simultaneously inserts are performed (duplicates by _lft will occur).
I think this behavior should be documented.
To ensure concurrency safety this package should perform all calculations on the database side with row locking during update.
For concurrency safe inserts, the following queries should be used (when
parent_id
is set):If
parent_id
is not set, the following queries should be used:Refs:
The text was updated successfully, but these errors were encountered: