nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.26k stars 3.96k forks source link

Allow for higher sync rate for subsciption calendars #46171

Open miaulalala opened 3 weeks ago

miaulalala commented 3 weeks ago

@tcitworld wrote:

The Nextcloud server caches the subscriptions (stores data in the database) and exposes them as regular calendars. The default refresh rate for this is of one week, which is appropriate for things like public holiday calendars, but might not be for other things, for instance subscribing to a public calendar from another Nextcloud user, and expecting real-time sync.

This high refresh rate makes sense because on servers with a lot of users and subscriptions, the cron would keep wasting time refreshing calendars for nothing, and there could be a risk of the subscription source blocking the server's IP. For instance, as subscriptions can't be shared (or provided by the admin), if all 10 000 users from a company need to subscribe to the holiday calendar from their local government, that's 10 000 requests you need to make every X minutes/hours/days when the original calendar data only changes once or twice a year.

Nextcloud supports properties available for the subscription source to tell what's the appropriate refresh rate (X-PUBLISHED-TTL, REFRESH-INTERVAL), but in practice no-one provides them.

I think there's an issue about providing the setting to select an appropriate refreshment rate for each subscription to end-users in calendar, which would kinda solve most of the issue, though there's a risk users could abuse it, so a minimal rate setting for the admin would be nice as well. In any case, that's not the current state.

So on the other hand, clients have no issue with refreshing the local subscription every 15 minutes/hour/day or even each time the app is opened, as it's only doing it for a single user and from a dedicated IP address.

Therefore, people who would have been forced to manually add the subscription on their device before this change and will now just used the exposed subscriptions from the NC server may have the impression that subscriptions don't get updated when they expect it.


We should take a delta of calendar events and only update those events that have changed.

We should also update all calendars that have the same subscription URI (ex: holiday calendars) at the same time so we only need one run for these calendars.

To Do:

ChristophWurst commented 2 weeks ago

@miaulalala can this be broken down into manageable chunks? E.g. 1) Efficient subscription sync (delta sync) 2) Adaptive/configurable sync intervals 3) Bulk sync for identical URIs

miaulalala commented 1 week ago

@miaulalala can this be broken down into manageable chunks? E.g.

1. Efficient subscription sync (delta sync)

2. Adaptive/configurable sync intervals

3. Bulk sync for identical URIs

Yes, that sounds reasonable! Shall I open work package tickets for each?

ChristophWurst commented 1 week ago

yes please

ChristophWurst commented 1 week ago

Efficient subscription sync (delta sync)

Tracked in https://github.com/nextcloud/server/issues/43541 more or less