discourse/spec/lib/stylesheet
David Taylor 501b2e3efe
PERF: Memoize fs_asset_cachebuster in the test environment (#39937)
Previously, `Stylesheet::Manager.fs_asset_cachebuster` only memoized in
production, so under `Rails.env.test?` every call re-walked
`app/assets/stylesheets`, `app/assets/images`, `lib/stylesheet`, and
every plugin's `assets/stylesheets` to compute an mtime — observable as
~13% of the themes seed under stackprof and ~380 redundant filesystem
scans per `db:seed`.

This change widens the memoization branch to `Rails.env.production? ||
Rails.env.test?` so the existing `manifest_full_path` content-hash path
is used in test too (it already handles parallel workers via
`TEST_ENV_NUMBER`), and rewrites the spec to cover both the manifest
path and the mtime path explicitly via a
`use_file_hash_for_cachebuster?` stub.

Extracted from https://github.com/discourse/discourse/pull/39788.
2026-05-12 21:44:40 +01:00
..
compiler_spec.rb DEV: move mobile select-kit CSS to common files (#39055) 2026-04-02 13:46:06 -04:00
importer_spec.rb FIX: Allow creating new color palettes based on custom palettes (#34351) 2025-08-20 11:58:40 +08:00
manager_spec.rb PERF: Memoize fs_asset_cachebuster in the test environment (#39937) 2026-05-12 21:44:40 +01:00