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
A benchmark on a seeded database (4 000 assets, 3 900 Jamf devices, 50 000 extension attribute values, 50 000 pending imports) showed several avoidable costs added by the plugin to every GLPI request and to its own pages. It also showed a crash on the main tab of Jamf-linked assets when Twig strict variables are enabled (dev and test environments):
Fix
setup.php: remove thePlugin::isPluginActive('jamf')check fromplugin_init_jamf(). GLPI already calls the init only for active plugins, and the check readglpi_pluginstwice on every HTTP request, AJAX calls included.inc/migration.class.php: add an index onglpi_plugin_jamf_mobiledevices.glpi_plugin_jamf_devices_idin the 3.2.4 migration. The join done on every Phone form scanned the whole table.front/merge.php/merge.html.twig: hide the already linked items with a dropdowncondition(subquery) instead of an inlineusedlist of every linked id in each row. The page no longer reads the whole devices table.inc/abstractdevice.class.php: cachegetJamfItemClassForGLPIItem()per request (it runs once per tab name and once for the information block). The cache entry is cleared when the item is purged.inc/connection.class.php: add a connect timeout (5 s) and a total timeout (30 s) to the Jamf API calls (Guzzle client and token requests). The MDM commands tab calls the API while it renders, and a slow Jamf server could block the page and the PHP worker.js/jamf.jsis now loaded only by the MDM commands tab instead of every GLPI page.inventory_info.html.twig: testbutton.url is definedto fix the crash above.Results
Display times did not change significantly at these volumes. The gains grow with the size of the fleet.
Notes