Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotificationFetcher does not fetch all notifications #3648

Closed
nikclayton opened this issue May 13, 2023 · 0 comments · Fixed by #3700
Closed

NotificationFetcher does not fetch all notifications #3648

nikclayton opened this issue May 13, 2023 · 0 comments · Fixed by #3700

Comments

@nikclayton
Copy link
Contributor

To repeat the comment from #3626:

fetchNotifications (fetchNewNotifications in this PR) makes one call to get new notifications (mastodonApi.notificationsWithAuth).

That will return N new notifications, starting with the oldest new one, up to limit. limit is not set in this code, and is documented as being default=15 max=30 at https://docs.joinmastodon.org/methods/notifications/#get.

If we can trust these documented defaults this means that in any given notification fetch (i.e., approx every 15 minutes) Tusky will get the batch of next-newest 15 notifications and display them. If the user has more notifications than that they will have to wait another ~ 15 minutes until they are fetched.

That's probably also a source of user complaints about missing notifications.

Fix is to either:

  1. Use the NotificationsRepository and fetch the notifications that way, taking advantage of its existing code for paging up (prepending) the list of notifications. Not sure how well Pager3 is suited to that though.
  2. Write some additional code here that repeatedly fetches new notifications until there are no new ones.

Originally posted by @nikclayton in #3626 (comment)

nikclayton added a commit that referenced this issue Jun 1, 2023
…tifications (#3700)

* Fetch all outstanding Mastodon notifications when creating Android notifications

Previous code fetched the oldest page of unfetched Mastodon notifications.

If you had more than a page of Mastodon notifications you'd get Android notifications for that page, then ~ 15 minutes later Android notifications for the next page, and so on.

This code fetches all the outstanding notifications at once.

If this results in more than 40 total notifications the list is still trimmed so that a maximum of 40 Android notifications is displayed.

Fixes #3648

* Build the list using buildList
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 a pull request may close this issue.

1 participant