Commit Graph

7 Commits

Author SHA1 Message Date
Jean Boussier 7b5096947e Call Executor#wrap around each test
It's `Rails.application.executor.wrap` that is responsible for
clearing request/job local state such as `CurrentAttributes`.

Instead of including an ad hoc helper to clear `CurrentAttributes` it's
better to run the executor so we properly clear other states as well.

However it means all executor hooks now need to be re-entrant.
2021-10-28 15:18:29 +02:00
John Hawthorn 9a4c1e205e Don't clear view cache during concurrent requests
This updates ActionView::CacheExpiry to hold a lock while inside the
executor (ie. inside a request) and to only clear caches when that is
done.

This is done using Concurrent::ReadWriteLock. This allows any number
of parallel requests to hold the read lock, but once we detect a change
and begin to acquire the write lock, all future requests will be
blocked.
2021-04-19 09:36:38 -07:00
Vinicius Stock 732372c928
Reduce allocations in action_view cache expiry 2020-05-22 18:38:56 -04:00
Ryuta Kamizono c81af6ae72 Enable `Layout/EmptyLinesAroundAccessModifier` cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
yuuji.yaginuma a72f19a6c3 Only clear cache when view paths are specified
Currently, `clear_cache_if_necessary` is executed even if view paths are
not set like `rails console`.
If the watcher class is `EventedFileUpdateChecker` and the watch
directories are empty, the application root directory will watch. This
is because listen uses the current directory as the default watch directory.
8d85b4cd57/lib/listen/adapter/config.rb (L13)

As a result, `node_modules` also watch. This cause a warning of `listen`.
Ref: https://github.com/rails/rails/pull/36377#issuecomment-498399576
2019-06-04 08:44:28 +09:00
John Hawthorn be34af0c53 Wrap actionview cache expiry in a mutex 2019-05-21 19:46:42 -07:00
John Hawthorn c8bf334104 Only clear template caches in dev after changes (#35629) 2019-04-01 21:22:57 +02:00