mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-15 15:29:48 +08:00
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. |
||
|---|---|---|
| .. | ||
| compiler_spec.rb | ||
| importer_spec.rb | ||
| manager_spec.rb | ||