Skip to content

Use runtime mode to determine cache TTL for manifest files#16393

Merged
kjac merged 2 commits intov14/devfrom
v14/feature/use-runtime-mode-for-manifest-cache-busting
May 27, 2024
Merged

Use runtime mode to determine cache TTL for manifest files#16393
kjac merged 2 commits intov14/devfrom
v14/feature/use-runtime-mode-for-manifest-cache-busting

Conversation

@kjac
Copy link
Contributor

@kjac kjac commented May 24, 2024

Prerequisites

  • I have added steps to test this contribution in the description below

Description

Currently the umbraco-package.json files are read and cached with a configurable TTL (set in PackageManifestSettings). In principle this is fine... but in reality, devs won't realize the TTL option and be annoyed by having to restart the site whenever they make changes to the manifest files.

This PR bases the cache TTL on the current runtime mode, effectively only caching manifests in Production mode (in the other runtime modes, the manifests are cached for 10 seconds to avoid re-reading the manifests twice when the client requests public and private manifests in rapid succession).

The PackageManifestSettings have been introduced as part of V14, and currently it only controls the cache TTL, so I have remove it (we can always re-introduce it later if the need arises). Therefore, this PR is breaking, but only against the previous V14 RCs 😄

Testing this PR

Use Swagger to fetch the manifests (reach out to @kjac if you need a manifest for testing). Make a change to a manifest, wait a few seconds and fetch the manifests again. The changed manifest should be reflected in the output.

Copy link
Contributor

@Migaroez Migaroez left a comment

Choose a reason for hiding this comment

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

Code looks good, works as described 🚀

@kjac kjac merged commit e778026 into v14/dev May 27, 2024
@kjac kjac deleted the v14/feature/use-runtime-mode-for-manifest-cache-busting branch May 27, 2024 08:33
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.

2 participants