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> Stephen Holsapple <sholsapp@gmail.com>
Steven Cummings <estebistec@gmail.com> Steven Cummings <estebistec@gmail.com>
Sébastien Fievet <zyegfryed@gmail.com> Sébastien Fievet <zyegfryed@gmail.com>
Talha Malik <talham7391@hotmail.com>
TedWantsMore <TedWantsMore@gmx.com> TedWantsMore <TedWantsMore@gmx.com>
Thomas Grainger <tagrain@gmail.com> Thomas Grainger <tagrain@gmail.com>
Thomas Steinacher <tom@eggdrop.ch> Thomas Steinacher <tom@eggdrop.ch>

View File

@ -19,12 +19,10 @@ class Reloader(threading.Thread):
super().__init__() super().__init__()
self.setDaemon(True) self.setDaemon(True)
self._extra_files = set(extra_files or ()) self._extra_files = set(extra_files or ())
self._extra_files_lock = threading.RLock()
self._interval = interval self._interval = interval
self._callback = callback self._callback = callback
def add_extra_file(self, filename): 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): def get_files(self):
@ -34,7 +32,6 @@ class Reloader(threading.Thread):
if getattr(module, '__file__', None) if getattr(module, '__file__', None)
] ]
with self._extra_files_lock:
fnames.extend(self._extra_files) fnames.extend(self._extra_files)
return fnames return fnames