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

Add CachedBundleDynamicFileProvider to sync bundle files using cache. #19870

Merged
merged 1 commit into from
May 30, 2024

Conversation

maliming
Copy link
Member

@maliming maliming commented May 20, 2024

Resolve #19861

The situation:

Two servers (A and B) are on the backend to serve.

  1. Browser request index page on Server A.
  2. Server A index page renders the bundle tag helper, then adds bundle files to DynamicFileProvider.
  3. Browser requests bundle file, but the request is forwarded to Server B.
  4. Server B gets 404 because no bundle files are added to DynamicFileProvider.

This PR adds the bundle files to Redis so other servers can get files correctly.

How to test it?

  1. Enable Redis.
  2. BundleAndMinify the js and css
Configure<AbpBundlingOptions>(options =>
{
    options.Mode = BundlingMode.BundleAndMinify;
}
  1. Run the web app and navigate to the home page to ensure the bundle files are loaded once and cached.
  2. Stop the web app and try to get a bundle file(https://localhost:44303/__bundles/LeptonXLite.Global.C8BD9C08002E46065415D954057C9304.js), DO NOT open the home page this time.
  3. The bundle file should not be 404.

@maliming maliming marked this pull request as ready for review May 21, 2024 03:00
@maliming maliming added this to the 8.1-patch milestone May 21, 2024
@maliming maliming changed the base branch from dev to rel-8.1 May 21, 2024 03:01
@hikalkan
Copy link
Member

Good solution. Thanks.

@hikalkan hikalkan merged commit 37eb218 into rel-8.1 May 30, 2024
2 of 3 checks passed
@hikalkan hikalkan deleted the CachedBundleDynamicFileProvider branch May 30, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make DynamicFileProvider support web farm.
3 participants