yapstudios / YapDatabase

YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers.
Other
3.35k stars 365 forks source link

CloudKit rate limiting #355

Open zsau opened 8 years ago

zsau commented 8 years ago

Unless I'm missing something, it's not possible to limit how frequently the CloudKit extension uploads changes to the server, short of doing everything manually. Is rate-limiting (possibly per-collection) a feature that would be considered, if I submitted a pull request?

Motivation: my app updates certain collections very often, but they are not that crucial to upload to CloudKit in a timely manner (mostly UI state stuff). I already limit how often the values are persisted to the database, but for the sake of updating the UI I still want to save these values to the local DB pretty frequently, more so than makes sense for CloudKit syncing.

robbiehanson commented 8 years ago

Correct, there isn't a baked-in solution for this. That is, there isn't anything simple like an existing rateLimit property.

You could implement something like exponential back-off once you start receiving rate-limited errors from the server. This could be done in a simplistic fashion my suspending/resuming the CloudKit extension instance.

Is rate-limiting (possibly per-collection) a feature that would be considered, if I submitted a pull request?

Built-in rate limiting is definitely something the project would be interested in !