5 Commits

Author SHA1 Message Date
Mark Adams
92d48256e4 Modify 'reload' config to be more consistent with existing API
--reload = Runs the reloader with inotify if available and falls back on
           FS polling.
--reload=inotify = Forces the reloader to run with inotify
--reload=poll = Forces the reloader to use FS polling
2016-10-24 11:39:10 -05:00
Mark Adams
64b26ef766 Fix #1368 by adding InotifyReloader and 'use-inotify' configuration option
Currently, '--reload' uses FS polling to find out when files have
changed. For some time, the Linux kernel has had a feature called
inotify that allows applications to monitor for FS events without
polling.

This commit adds a new 'use-inotify' configuration option that will
cause gunicorn to use the new 'InotifyReloader' instead of the default
'Reloader' when 'reload' is enabled.

Using inotify can result in lower CPU consumption by gunicorn especially
when working with virtualized filesystems or environments with a large
number of watched files / directories.
2016-10-17 21:21:37 -05:00
Berker Peksag
da5e847b63 Fix RuntimeError in gunicorn.reloader.
Here's the reproducer in Python 3.3:

    $ gunicorn --paste paste.ini --reload

Then I got the following exception:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/threading.py", line 901, in _bootstrap_inner
    self.run()
  File "/home/berker/hacking/mediagoblin/venv3/lib/python3.3/site-packages/gunicorn/reloader.py", line 41, in run
    for filename in self.get_files():
  File "/home/berker/hacking/mediagoblin/venv3/lib/python3.3/site-packages/gunicorn/reloader.py", line 29, in get_files
    for module in sys.modules.values()
  File "/home/berker/hacking/mediagoblin/venv3/lib/python3.3/site-packages/gunicorn/reloader.py", line 28, in <listcomp>
    re.sub('py[co]$', 'py', module.__file__)
RuntimeError: dictionary changed size during iteration
2014-06-28 07:03:31 +03:00
Yue Du
cb817dfa98 Remove unused imports 2014-05-14 14:08:18 +08:00
Randall Leeds
e106bf82a8 Add --reload option for code reloading
Fix #526
2014-01-15 19:08:34 -08:00