mockko / livereload

LiveReload applies CSS/JS changes to Safari or Chrome w/o reloading the page (and autoreloads the page when HTML changes)
http://livereload.com/
1.18k stars 56 forks source link

Doesn't work when I run it from ~ #17

Open NV opened 14 years ago

NV commented 14 years ago
➤ livereload --version
1.4
➤ livereload ~
Version:  1.4  (compatible with browser extension versions 1.4.x)
Port:     35729
Watching: /Users/nikitavasilev
  - extensions: .html .css .js .png .gif .jpg .php .php5 .py .rb .erb
  - excluding changes in: */.git/* */.svn/* */.hg/*
  - with a grace period of 0.05 sec after each change

CPU is hot!

CPU was warm, but livereload wasn't working. I was waiting for about 10 minutes, but nothing changed. I suppose, it scans files, but doesn't show me any progress bar.

Then I pressed Ctrl + C

^C/usr/local/lib/ruby/1.8/set.rb:264:in `merge': Interrupt
    from /usr/local/lib/ruby/1.8/set.rb:76:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:75:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:75:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
    from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:76:in `refresh!'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/tree.rb:173:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/monitor.rb:21:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/monitor.rb:21:in `watch'
    from /usr/local/lib/ruby/gems/1.8/gems/livereload-1.4/bin/../lib/livereload.rb:175:in `restart_watching'
    from /usr/local/lib/ruby/gems/1.8/gems/livereload-1.4/bin/../lib/livereload.rb:243:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/livereload-1.4/bin/../lib/livereload.rb:243:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/livereload-1.4/bin/../lib/livereload.rb:243:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
    from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/livereload-1.4/bin/../lib/livereload.rb:215:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/livereload-1.4/bin/livereload:51
    from /usr/local/bin/livereload:19:in `load'
    from /usr/local/bin/livereload:19

I would say how many files I have if I knew how to measure.

ls **/*.{html,css,js,png,gif,jpg} | xargs wc -l
zsh: argument list too long: ls
       0
dottedmag commented 14 years ago

Watchers are set up for directories, not for particular files. So

find ~ -type d | wc -l

Anyway, watching whole $HOME is not expected to work, so I'm inclined to close as 'wontfix'.

andreyvit commented 14 years ago

Unfortunately, monitoring HOME is not a good idea at the moment, since LR has to keep the whole file tree in memory for comparisons, and you likely do not want to wait for it to build it on each start up.

Also, on Linux, the number of watched directories on a single inotify handle is limited, and we're just using one handle. Using multiple handles when necessary would be a nice fix to have if someone is willing to contribute.

I don't see why LR startup should take much longer than it takes to run find ~, so if someone can step in, fix inotify handles limit and then make reading a list of directories faster, LR should be able to work from $HOME.

I'm changing this from wontfix to help-wanted-otherwise-wontfix :)

NV commented 14 years ago
Sites ➤ find . -type d | wc -l
    5897
Sites ➤ livereload

Version:  1.4  (compatible with browser extension versions 1.4.x)
Port:     35729
Watching: /Users/nikitavasilev/Sites
  - extensions: .html .css .js .png .gif .jpg .php .php5 .py .rb .erb
  - excluding changes in: */.git/* */.svn/* */.hg/*
  - with a grace period of 0.05 sec after each change

LR works, but ruby process takes 100% CPU. It's pretty bad when outside is +40°C :)

However, It works well with a few directories.

andreyvit commented 14 years ago

100% CPU means it's still loading the directory tree. I have no idea why it takes so long (wild guess: stat()'ing each file is wildly inefficient, and find(1) only uses the info provided by directory scanning functions). That's the area where I want to see contributions.