Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

fix(load-modules): unnecessary calls to updateModuleRegistry #939

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

JAdshead
Copy link
Contributor

@JAdshead JAdshead commented Mar 3, 2023

Description

currently any module which does not get loaded correctly is re-required on every module map poll.
This change limits fetching and parsing modules to one round per change in the module map.

Motivation and Context

limit unnecessary calls to require-from-string which consumes memory.

How Has This Been Tested?

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update
  • Security update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • These changes should be applied to a maintenance branch.
  • This change requires cross browser checks.
  • Performance tests should be ran against the server prior to merging.
  • This change impacts caching for client browsers.
  • This change impacts HTTP headers.
  • This change adds additional environment variable requirements for One App users.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using One App?

None

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

Size Change: 0 B

Total Size: 687 kB

ℹ️ View Unchanged
Filename Size
./build/app/app.js 164 kB
./build/app/app~vendors.js 389 kB
./build/app/runtime.js 7.07 kB
./build/app/service-worker-client.js 7.26 kB
./build/app/vendors.js 120 kB

compressed-size-action


const moduleMapHash = hash(moduleMap);
if (cashedModuleMapHash && cashedModuleMapHash === moduleMapHash) {
return {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there value in logging here, maybe in the non-cache-hit case? so those who watch logs can see '3 modules change since last poll' and have confirmation that the change has actually been processed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already log that

`pollModuleMap: ${numberOfModulesLoaded} modules loaded/updated:`,

@JAdshead JAdshead force-pushed the fix/reduce-unnecessary-module-map-parsing branch from 2b60c63 to 17a3b4d Compare March 6, 2023 22:19
src/server/utils/loadModules.js Outdated Show resolved Hide resolved

const moduleMapHash = hash(moduleMap);
if (cashedModuleMapHash && cashedModuleMapHash === moduleMapHash) {
return {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already log that

`pollModuleMap: ${numberOfModulesLoaded} modules loaded/updated:`,

@10xLaCroixDrinker 10xLaCroixDrinker requested a review from a team March 7, 2023 17:02
@JAdshead JAdshead merged commit 99ef4f1 into main Mar 7, 2023
@JAdshead JAdshead deleted the fix/reduce-unnecessary-module-map-parsing branch March 7, 2023 18:23
JAdshead added a commit that referenced this pull request Mar 7, 2023
* fix(load-modules): unnecessary calls to updateModuleRegistry

* test(integration): update to ensure module map reset)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants