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

(Update) Only delete upsert data after successful upsertion #3943

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

Roardom
Copy link
Collaborator

@Roardom Roardom commented Jun 23, 2024

TODO: need to ensure the next upsert isn't started before the previous upsert finishes. (Does laravel's scheduler allow only one at a time when it's more frequently than a minute?)

The laravel scheduler repeats the job as many times as needed waiting 5 seconds in between each time. Once the minute finishes, it doesn't run anymore: https://github.com/laravel/framework/blob/966a22ac8f7a5191e17818ce5eb5d0df2543e114/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php#L228.
It needed ->withoutOverlapping(2) to ensure the next upsert is skipped if previous upsert is still running. I chose a 2 minute cache lock ttl which provides an extra minute after the run of the previous minute has finished to wait for any deadlocks to finish erroring (max of 5 times is specified in the transaction).

@Roardom Roardom force-pushed the save-upserts branch 2 times, most recently from d0c7e85 to ec21147 Compare February 13, 2025 07:09
@Roardom Roardom marked this pull request as ready for review February 13, 2025 09:53
@HDVinnie HDVinnie merged commit 052acb0 into HDInnovations:8.x.x Feb 13, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants