-
Notifications
You must be signed in to change notification settings - Fork 0
feat: paginated the Leantime delete sync #334
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0613fe8
feat: paginated the Leantime delete sync
tuj 8f10977
fix: updated the phpstan baseline for the paginated delete sync
tuj ec76bcb
feat: sent the delete timestamp as deletedAfter
tuj 03b85be
docs: recorded what keeps the delete order, not that it is kept
tuj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can not be guaranteed when running async. Depending on the entity model consider using doctrines orphan removal to also delete children when parents are deleted.
Or scope deletes by projects so that all deletes within a project happens as one message/job.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that the queue gives no ordering guarantee, and the comment was wrong to imply the
constant provides one. What actually holds the order here is that this path is not async:
SyncDeletedCommand calls deleteAll(false, …), so both the delete messages and the
EntityRemovedFromDataProviderMessages get TransportNamesStamp('sync') and every handler runs
inline — including the next-page dispatch, so a type's pages all finish before the next type
starts. I've rewritten the comment to say that, and to record that fanning the four types out up
front only works under inline handling: switching this path to async would mean chaining the types
instead.
On orphan removal — it would take billing data with it. projectRemovedFromDataProvider() and
issueRemovedFromDataProvider() refuse to hard-delete while invoice-bound children exist and set
sourceDeletedDate instead, and worklogRemovedFromDataProvider() protects any worklog attached
to an invoiceEntry. A cascade from the parent would delete exactly the rows those checks exist to
keep.
On scoping by project — /deleted pages by type over deletionId and has no project dimension, so
grouping by project would mean holding the whole deletion history in memory, which is what the
pagination is here to avoid.
Digging into this did turn up a real bug, unrelated to pagination:
projectRemovedFromDataProvider() checks invoices, issues and worklogs but not versions, and
version.project_id has no ON DELETE, so a project whose milestone deletion was missed passes the
removable check and then hits an FK violation. Fixing that separately.