rtyler / Spawning

Spawning is a wsgi server which supports multiple processes, multiple threads, green threads, non-blocking HTTP io, and automatic graceful upgrading of code
http://pypi.python.org/pypi/Spawning
MIT License
120 stars 18 forks source link

Add options to change reload interval and ignore sys.modules #16

Open AdamG opened 13 years ago

AdamG commented 13 years ago

sha: 50e83479c887654425dc89fe4f2a970ee8b690ba

I'm not quite happy with this change - it seems to me that watching sys.modules should be a default-true option of its own - but it maintains backwards compatibility while allowing the use case that I needed - watching a particular file while ignoring sys.modules.

The reason for not watching sys.modules is just to avoid len(sys.modules) * child processes * num spawning instances stat calls every second. --reload-interval has the same purpose.

AdamG commented 13 years ago

The original commit is way out of date now, especially with the source-dir-renaming thing. Here's an updated patch:

http://static.gomaa.us/adam/patches/spawning-2011-04-27-watch-single-file.patch

It removes the passing of --reload to children, since that was ignored by the spawning_child code. Instead, watching sys.modules only happens if you pass --reload=dev. If you pass only --watch=whatever, only that file is watched (currently, sys.modules would be watched as well). Both reload and watch can be used to get the current sys.modules + watched file behavior.