Skip to content

A platform for community discussion. Free, open, simple.

DEV: Speed up requests in development mode (#12890)

David Taylor59c239d85cf8
diff --git a/config/application.rb b/config/application.rb
index b8294b14c18..f29044b5f63 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -120,6 +120,19 @@ module Discourse
Rails.autoloaders.main.ignore(Dir["#{config.root}/app/models/reports"])
Rails.autoloaders.main.ignore(Dir["#{config.root}/lib/freedom_patches"])
+ def watchable_args
+ files, dirs = super
+
+ # Skip the assets directory. It doesn't contain any .rb files, so watching it
+ # is just slowing things down and raising warnings about node_modules symlinks
+ app_file_extensions = dirs.delete("#{config.root}/app")
+ Dir["#{config.root}/app/*"].reject { |path| path.end_with? "/assets" }.each do |path|
+ dirs[path] = app_file_extensions
+ end
+
+ [files, dirs]
+ end
+
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 53025e00656..8d9ffb6513c 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -7,6 +7,7 @@ Discourse::Application.configure do
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Log error messages when you accidentally call methods on nil.
config.eager_load = false