Repository navigation
Make build-time warming of the OpenAPI documents opt-in - #58
Merged
Merged
Conversation
Generate them on the first API request by default, and cache the area map in the cache dir when the build dir is read-only.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (17)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The cache dir can outlive a deploy, and outside debug mode an existing file counts as fresh.
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.
Summary
Since 0.14.1,
cache:warmupandcache:cleargenerate each Nelmio area's OpenAPI document and the route-to-area map through two optional cache warmers. Generating a document describes every route and model in the area, which in a large application takes seconds and over 100 MB per area, inside a command that already carries the container build and Symfony's own warmers. It also resolves%env()%values at build time.Both caches already fill themselves on first use, so the warmers only move that cost from the first request to build time. That is now a choice per project:
false): the warmers are not registered. The first API request that needs an area's document or the area map generates and caches it, using the runtime env values.true: both are taggedkernel.cache_warmerand warmed as in 0.14.1 and 0.14.2, including the warm-up warning and the fallback to the warmed document.kernel.cache_dirwhen the build dir can't be written. Without warm-up it would otherwise be rebuilt, loading Nelmio's route collections, in every request. The map is built once and then written to the first writable directory.container.build_id, as Symfony's system cache pool is). The cache dir can outlive a deploy, and outside debug mode a cached file counts as fresh as long as it exists, so a later deploy would otherwise reuse the previous deploy's area map or document.This changes the default; see Upgrading in the changelog: set
openapi.warm_up: trueto keep warming.Tests
warm_updefaults tofalse; by default neither service is a cache warmer, withwarm_up: trueboth are.warm_up: true, warming writes every area's document and the area map;warm_up: true.