Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist before requesting a review
Description
Pages that display alerts (ticket form, central page, ticket list) get slower as alerts accumulate, even when only a few of them are current. On a base with 50 000 alerts (100 current), the ticket form is ready about 480 ms later with the plugin than without it.
Causes:
<style>and<script>. The script reads and writes computed styles with jQuery, which forces a full style recalculation of the page per alert (22 ms per alert on a large ticket form).PluginNewsAlert::findAllToNotify()filters onis_active,is_deletedand the dates, but no index covers them: MariaDB scans the whole alert table, twice per display (14 to 20 ms per query).plugin_init_news()checksisInstalled()+isActivated(), which costs 4 queries on every HTTP request; the core only calls it for an active plugin.PluginNewsAlert_Target::showForAlert()loads each target with onegetFromDB().PluginNewsAlert::post_updateItem()callsupdate()once per user who hid the alert.news.jsbinds its delegated handlers again on everyglpi.tab.loaded, so closing an alert sends onehide_alert.phprequest per tab loaded before.Fix
color-mix(), the full width on ITIL forms is a CSS rule instyles.css; the per-alert script and style are removed.is_active_is_deleted_date_endonglpi_plugin_news_alerts, added by the migration (fresh install and update).plugin_init_news().UPDATEon alert update.Performance impact
Measured on GLPI 11.0.13 (e2e environment, debug mode off), 50 000 alerts, 100 570 targets, 50 000 hidden states. Medians of 5 runs; SQL from the MariaDB log.
hide_alert.phprequestsNotes
news.jsandstyles.cssin cache.color-mix()requires Chrome 111, Firefox 113 or Safari 16.2.