Skip to content

Conversation

@st3iny
Copy link
Member

@st3iny st3iny commented Aug 4, 2025

Summary

Allow notifier implementations to preload and cache data for many notifications at once to improve performance by, for example, bundling SQL queries.

Checklist

* improve performance by, for example, bundling SQL queries.
*/
#[Implementable(since: '32.0.0')]
interface IPreloadableNotifier extends INotifier {
Copy link
Member

Choose a reason for hiding this comment

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

We should deprecate INotifier (but can also wait one release), to make developers more aware of the performance related improvement

Copy link
Member Author

@st3iny st3iny Aug 5, 2025

Choose a reason for hiding this comment

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

I would rather integrate the method into the actual interface rather than deprecating it. Otherwise, Psalm will complain all the time about INotifier being deprecated and we will end up with IPreloadableNotifier becoming the base interface at some point which sounds weird.

I added a hint to INotifier though to make developers aware.

Copy link
Member

Choose a reason for hiding this comment

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

Well we can not extend the base interface due to our policies
And deprecating the other one would help via psalm and IDEs that was exactly my idea to it.

If an app doesn't care they can implement the interface and do nothing in the method, but get easily rid of the deprecation?

Copy link
Member

Choose a reason for hiding this comment

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

I'd vote for keeping the old interface as-is because the usage is not always problematic. With documentation (manual, code in-line) we can get attention to the extending interface for apps where preloading makes sense.

@st3iny st3iny added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 5, 2025
@st3iny st3iny marked this pull request as ready for review August 5, 2025 13:50
@st3iny st3iny requested review from ArtificialOwl, nickvergessen, provokateurin and yemkareems and removed request for a team August 5, 2025 13:50
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Looks good

* improve performance by, for example, bundling SQL queries.
*/
#[Implementable(since: '32.0.0')]
interface IPreloadableNotifier extends INotifier {
Copy link
Member

Choose a reason for hiding this comment

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

I'd vote for keeping the old interface as-is because the usage is not always problematic. With documentation (manual, code in-line) we can get attention to the extending interface for apps where preloading makes sense.

@st3iny st3iny force-pushed the feat/notifications/preload-many branch from a2fb8d9 to ad39dab Compare August 6, 2025 07:23
@st3iny st3iny added this to the Nextcloud 32 milestone Aug 6, 2025
@st3iny st3iny added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 6, 2025
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

:shipit:

@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Aug 6, 2025
@ChristophWurst
Copy link
Member

ChristophWurst commented Aug 6, 2025

New API -> needs dev manual docs

nextcloud/documentation#13485

@st3iny st3iny merged commit ee65967 into master Aug 6, 2025
204 of 208 checks passed
@st3iny st3iny deleted the feat/notifications/preload-many branch August 6, 2025 07:57
@skjnldsv skjnldsv mentioned this pull request Aug 19, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement feature: activity and notification pending documentation This pull request needs an associated documentation update performance 🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide INotifier::preloadMany() to allow implementations to preload and cache data for many notifications at once

5 participants