fix(dav): compare sync token retention against an absolute cutoff#60178
Open
mooons wants to merge 1 commit intonextcloud:masterfrom
Open
fix(dav): compare sync token retention against an absolute cutoff#60178mooons wants to merge 1 commit intonextcloud:masterfrom
mooons wants to merge 1 commit intonextcloud:masterfrom
Conversation
Signed-off-by: mooons <10822203+mooons@users.noreply.github.com>
8c595a8 to
938e2c1
Compare
Member
|
I have restored the PR template. Please fill it out. |
Member
ChristophWurst
left a comment
There was a problem hiding this comment.
Changes make sense
Thanks for the contribution!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
PruneOutdatedSyncTokensJobcomputesretentionas a duration in seconds fromsyncTokensRetentionDays, but both DAV backends currently compare that value directly againstcreated_atinpruneOutdatedSyncTokens().created_atstores Unix timestamps, so this ends up using a relative duration as if it were an absolute timestamp. With the default 60-day retention, the generated condition is effectivelycreated_at <= 5184000, which does not match normal rows.Fix
Convert the duration into an absolute cutoff inside the backend methods before building the delete query:
and compare
created_atagainst$cutoff.This preserves the current method signatures and config semantics.
Root cause
The retention value is produced as an age duration in
PruneOutdatedSyncTokensJob, but treated as an absolute timestamp in:OCA\DAV\CalDAV\CalDavBackend::pruneOutdatedSyncTokens()OCA\DAV\CardDAV\CardDavBackend::pruneOutdatedSyncTokens()Impact
Without this fix, old rows in
oc_calendarchangesandoc_addressbookchangesare not pruned as intended even when the background job runs.Related: #51120
Checklist
3. to review, feature component)stable32)AI (if applicable)