-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[ui/UiApp] sort used modules so entry files can be cache keys #15910
[ui/UiApp] sort used modules so entry files can be cache keys #15910
Conversation
The only way I know how to test this is to run # patch kibana to exit immediately after optimization
curl https://gist.githubusercontent.com/anonymous/49acf9ef2c8a7c60de93d030b3aa0989/raw/9dd0a0489e6b602f1d3ef43dbf85ab43258fae32/gistfile.diff | git apply
# optimize once to get a baseline
node scripts/kibana
# copy the optimize bundles directory for comparison once the cache is considered invalid
cp -r optimize/bundles optimize/valid_bundles
# run bin/kibana in a loop until it fails to reuse the cache
while true; do echo ""; echo "running..."; node scripts/kibana --verbose || break; done;
# compare the optimize/bundles/*.entry.js files with the optimize/valid_bundles/*.entry.js files In master this will run a few times and eventually fail to reuse the cache. If you can't get it to happen, try including x-pack. I find it triggers more often when x-pack is installed. |
87c45db
to
b49258a
Compare
b49258a
to
fe3d1dd
Compare
jenkins, test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a unit test or two for this? We already have a couple tests for getModules
, but they are not capturing this problem.
…ry-optimize-invalidation
35fb6c0
to
fd24ae5
Compare
fd24ae5
to
8017341
Compare
Good call @kjbekkelund, added tests for UiApp and also a couple that verify the assumptions this maintains for UiBundle and the appEntryTemplate |
jenkins, test this |
This is a nice change, thanks @spalger |
…c#15910) * [ui/UiApp] sort used modules so entry files can be cache keys * [ui/bundles+apps] test changes and verify assumptions down to appEntryTemplate
6.1/6.x: a676f08 |
Fixes elastic/kibana-docker#66
The order of appExtensions in uiExports is based on the load order of plugins, and can change even without a plugin being installed. This is currently causing the modules list for each uiApp to come back in slightly different orders every once and a while, which causes the
{app}.entry.js
files to have slightly different contents, triggering a run of the optimizer. This is especially painful because of how expensive optimization has become.To fix this,
uiApp
will now sort the appExtension module ids it collects from uiExports before providing them to the bundle files. They need to be sorted here (rather than in the bundle itself) so that we can verify that the main file for the app is still the first module in the list. The bundles will just render the modules list provided to them by theiruiApp
.