mirror of
https://github.com/discourse/discourse.git
synced 2025-03-01 08:49:20 +00:00
DEV: Skip unnecessary work when booting dev server on linux (#28401)
The Listen gem watches recursively, which has a cost per-file on Linux (via rb-inotify). This commit skips a bunch of unnecessary directories to reduce the startup cost.
This commit is contained in:
parent
9c1812e071
commit
e8308f783d
@ -11,6 +11,21 @@ if Rails.env.development? && !Rails.configuration.cache_classes && Discourse.run
|
||||
"#{Rails.root}/plugins",
|
||||
]
|
||||
|
||||
if Listen::Adapter::Linux.usable?
|
||||
# The Listen gem watches recursively, which has a cost per-file on Linux (via rb-inotify)
|
||||
# Skip a bunch of unnecessary directories to reduce the cost
|
||||
# Ref https://github.com/guard/listen/issues/556
|
||||
require "rb-inotify"
|
||||
INotify::Notifier.prepend(
|
||||
Module.new do
|
||||
def watch(path, *flags, &callback)
|
||||
return if path.end_with?("/node_modules", "/.git")
|
||||
super(path, *flags, &callback)
|
||||
end
|
||||
end,
|
||||
)
|
||||
end
|
||||
|
||||
Listen
|
||||
.to(*paths, only: /\.rb$/) do |modified, added, removed|
|
||||
supervisor_pid = UNICORN_DEV_SUPERVISOR_PID
|
||||
|
Loading…
x
Reference in New Issue
Block a user