Allow ENV variable to force polling

This commit is contained in:
Robin Ward 2017-08-16 12:59:21 -04:00
parent 0daeefc977
commit f9ff06b9d4
1 changed files with 5 additions and 1 deletions

View File

@ -37,10 +37,14 @@ module Stylesheet
end
root = Rails.root.to_s
listener_opts = { ignore: /xxxx/ }
listener_opts[:force_polling] = true if ENV['FORCE_POLLING']
@paths.each do |watch|
Thread.new do
begin
listener = Listen.to("#{root}/#{watch}", ignore: /xxxx/) do |modified, added, _|
listener = Listen.to("#{root}/#{watch}", listener_opts) do |modified, added, _|
paths = [modified, added].flatten
paths.compact!
paths.map! { |long| long[(root.length + 1)..-1] }