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

Improve kanban performances 2 #14599

Conversation

AdrienClairembault
Copy link
Contributor

@AdrienClairembault AdrienClairembault commented Apr 27, 2023

#14525 was not enough to fix the internal ref issue.

Long story short, #14525 fixed the image picture cache that is built from the cards data returned by the load_column_state ajax request.

image

However, the cards entry returned in this request do not contain all displayed cards, it only contains cards that where moved in the kanban (thus saving their custom positions).
This mean that we may have 0 cards returned by this request, which make our cache far less useful.

To fix this specific point and improve the overall performances, I've applied the following fixes:

1) Use user picture placeholder, load real pictures later

The kanban code is already able to display a fallback picture with the generateUserBadge function.

I've forced all users pictures to be displayed using this fallback method as a placeholder and kept track of their users id is a set.
After the kanban is fully displayed, I load the real images with a single ajax request and replace the placeholders.

This is similar to what the cache was doing but is done after the kanban is fully loaded (instead of before).
This mean we are sure to know all the users pictures that must be loaded and we wont impact the main loading process.

2) Use POST requests

As we use a single query to load all the pictures, it could be possible to exceed the max GET size if too much users_id are specified.
Using a POST request avoid this potential issue.

3) Remove the cache preload step

With this new system, we don't really need the cache preload step anymore so we can save a request by deleting it.

4) Remove synchronous requests

I've removed the last remaining call to $.ajax which used async: false to avoid blocking the main thread.
I've replaced it by async/await and tried to group the columns loading requests into a single await Promise.all to allow them to be executed concurrently.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets !27631

@AdrienClairembault
Copy link
Contributor Author

Bump for the reviews, would it be possible to validate this PR before the end of the week ?

@AdrienClairembault
Copy link
Contributor Author

Thanks :)

@cedric-anne cedric-anne merged commit 7c86ae7 into glpi-project:10.0/bugfixes May 4, 2023
@AdrienClairembault AdrienClairembault deleted the fix/kanban-performances-2 branch October 4, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants