Merge pull request #2134 from talham7391/2133-delay-reload

Start the reloader after the wsgi app has been loaded.
This commit is contained in:
Benoit Chesneau 2019-11-20 22:30:05 +01:00 committed by GitHub
commit 8d854ba8cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

1
THANKS
View File

@ -163,6 +163,7 @@ Stephen DiCato <Locker537@gmail.com>
Stephen Holsapple <sholsapp@gmail.com>
Steven Cummings <estebistec@gmail.com>
Sébastien Fievet <zyegfryed@gmail.com>
Talha Malik <talham7391@hotmail.com>
TedWantsMore <TedWantsMore@gmx.com>
Thomas Grainger <tagrain@gmail.com>
Thomas Steinacher <tom@eggdrop.ch>

View File

@ -19,13 +19,11 @@ class Reloader(threading.Thread):
super().__init__()
self.setDaemon(True)
self._extra_files = set(extra_files or ())
self._extra_files_lock = threading.RLock()
self._interval = interval
self._callback = callback
def add_extra_file(self, filename):
with self._extra_files_lock:
self._extra_files.add(filename)
self._extra_files.add(filename)
def get_files(self):
fnames = [
@ -34,8 +32,7 @@ class Reloader(threading.Thread):
if getattr(module, '__file__', None)
]
with self._extra_files_lock:
fnames.extend(self._extra_files)
fnames.extend(self._extra_files)
return fnames

View File

@ -116,6 +116,8 @@ class Worker(object):
self.init_signals()
self.load_wsgi()
# start the reloader
if self.cfg.reload:
def changed(fname):
@ -130,7 +132,6 @@ class Worker(object):
callback=changed)
self.reloader.start()
self.load_wsgi()
self.cfg.post_worker_init(self)
# Enter main run loop