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

My home: All events slow to load in large organizations #2430

Open
richardolsson opened this issue Dec 18, 2024 · 0 comments
Open

My home: All events slow to load in large organizations #2430

richardolsson opened this issue Dec 18, 2024 · 0 comments
Labels
🐜 bug Something isn't working 🐬 Medium Just a nice sized issue. 🛑 potentially blocked Potentially blocked by prerequisites (double check or ask someone, as it may have changed)

Comments

@richardolsson
Copy link
Member

Description

The new Activist portal prototype (introduced in #2425) has a tab for "all events", which retrieves all future events for all organizations that the user is connected to. There is no Zetkin API for doing this in one request, so all organizations need to be queried separately. We have implemented this using the getAllEvents RPC, meaning that the web app frontend asks the web app backend for all events, and the web app backend makes multiple requests to the Zetkin API – one to retrieve a list of the user's organizations and then one per organization.

Some users are connected to lots of organizations. National-level admins in large organizations will likely be connected to hundreds of organizations, but even regional-level admins can easily have 20-50 organizations, resulting in as many (+1) requests.

Steps to reproduce

  1. Go to https://app.dev.zetkin.org/my
  2. Sign in as testadmin@example.com
  3. Click on the "All events" tab

Expected Behaviour

The frontend should make a single API request to get all events, and the backend should then make as few requests as possible to the Zetkin API. The page should reasonably take at most a few seconds to load.

Actual Behaviour

The frontend makes a single API request to get all events, but the backend makes one for each organization in the tree. In the dev environment this does not take very long, but for a real user in a large production organization it can easily take 30 seconds or more.

Screenshots (if you have any)

None

Proposed solution

There is a Zetkin API for retrieving all events in an organization including all of it's sub-organizations recursively using the ?recursive flag. This means, in theory, that we could limit the number of requests by only retrieving events from organizations at the highest level we have access to.

I haven't tried whether this works, so it might also be the case that this requires changes to the Zetkin API.

@richardolsson richardolsson added 🐜 bug Something isn't working 🛑 potentially blocked Potentially blocked by prerequisites (double check or ask someone, as it may have changed) 🐬 Medium Just a nice sized issue. labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐜 bug Something isn't working 🐬 Medium Just a nice sized issue. 🛑 potentially blocked Potentially blocked by prerequisites (double check or ask someone, as it may have changed)
Projects
None yet
Development

No branches or pull requests

1 participant