I have the following table (MySQL):
This line of code in my asset model (mainly called by asynchronous jobs):
$this->sites()->syncWithPivotValues($sites, ['is_current_site' => true]);
My problem is that when I do this line I keep getting duplicate constraint errors and I don't understand why. Any ideas?
P粉0684862202023-09-15 00:34:14
The problem I am facing is the concurrency issue between jobs.
I used the WithoutOverlapping middleware (https://laravel.com /docs/9.x/queues#preventing-job-overlaps) to prevent concurrency problems on my jobs, and the effect is very good .