Skip to content

Improve Rails' code reloader to ignore mtime changes of files which haven't been loaded #212

Open
@jonleighton

Description

@jonleighton

Rails checks the mtime of files, so that Rails.application.reloaders.any?(&:updated?) is false if none of the files in the autoload path have changed. This allows us to avoid running the code reloader unnecessarily.

However, if we have a file app/models/order.rb, and we don't reference the Order constant during application startup, then a change in the mtime of app/models/order.rb needn't trigger the code reloader. However at the moment Rails just looks at the mtime of all files in the autoload path, regardless of whether those files were actually loaded.

Fixing this will result in fewer situations where we actually need to run the reloaders, which will improve the speed of running a command with spring.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions