Skip to content

Conversation

@mbrandonw
Copy link
Member

If the user runs out of iCloud storage, saving records will report a .quotaExceeded error. Currently we are not handling that error correctly. Those updates will never be retried again later (unless the record happens to be edited later). And there is currently no way for the user of our library to be notified of such errors so that they can let the user know that there is something for them to fix. This PR addresses both of those problems:

  • When we detect a .quotaExceeded error we not save the record ID to the PendingRecordZoneChanges table, which means they will be re-enqueued whenever the sync engine starts again. This will give the records a chance to save again at a later time.
    • Related to this, we also now retry those records if the sendChanges method is every explicitly called on the sync engine.
  • Added a new delegate method that allows listening for when saving records caused a .quoteExceeded error.

Comment on lines +95 to +96
/// This method can be called many times, and so you will want to de-duplicate the
/// `quotaExceeded` boolean so as to not alert your users multiple times.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should also have a quotaExceeded: Bool observable value on the SyncEngine? That would allow showing/hiding a banner in the UI.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be very handy!

@mbrandonw mbrandonw marked this pull request as draft December 19, 2025 16:42
@mbrandonw
Copy link
Member Author

I'm converting this to a draft because currently I'm not entirely sure how we can be notified of quotaExceeded errors from CKSyncEngine. Looking into it more...

Comment on lines +102 to +106
func syncEngine(
_ syncEngine: SyncEngine,
quotaExceeded: Bool,
scope: CKDatabase.Scope
)
Copy link
Member Author

@mbrandonw mbrandonw Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we surface the record/participant/CKShare that is responsible for the error?

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.

3 participants