Remove locking in polling reloader

This commit is contained in:
Talha Malik 2019-10-17 09:50:17 -04:00 committed by Talha Malik
parent a4b6b1385a
commit 51a4afd7ef
2 changed files with 3 additions and 5 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