Merge pull request #1265 from Nyaran/feature/py39_thread_is_alive
Change `thread.isAlive` to `thread.is_alive`
This commit is contained in:
commit
8fe72d281f
4 changed files with 6 additions and 6 deletions
|
@ -377,7 +377,7 @@ class BackgroundWorker(object):
|
||||||
return self._abort or app.APP.monitor.abortRequested()
|
return self._abort or app.APP.monitor.abortRequested()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self._thread and self._thread.isAlive():
|
if self._thread and self._thread.is_alive():
|
||||||
return
|
return
|
||||||
|
|
||||||
self._thread = KillableThread(target=self._queueLoop, name='BACKGROUND-WORKER({0})'.format(self.name))
|
self._thread = KillableThread(target=self._queueLoop, name='BACKGROUND-WORKER({0})'.format(self.name))
|
||||||
|
@ -403,13 +403,13 @@ class BackgroundWorker(object):
|
||||||
if self._task:
|
if self._task:
|
||||||
self._task.cancel()
|
self._task.cancel()
|
||||||
|
|
||||||
if block and self._thread and self._thread.isAlive():
|
if block and self._thread and self._thread.is_alive():
|
||||||
LOG.debug('thread (%s): Waiting...', self.name)
|
LOG.debug('thread (%s): Waiting...', self.name)
|
||||||
self._thread.join()
|
self._thread.join()
|
||||||
LOG.debug('thread (%s): Done', self.name)
|
LOG.debug('thread (%s): Done', self.name)
|
||||||
|
|
||||||
def working(self):
|
def working(self):
|
||||||
return self._thread and self._thread.isAlive()
|
return self._thread and self._thread.is_alive()
|
||||||
|
|
||||||
|
|
||||||
class NonstoppingBackgroundWorker(BackgroundWorker):
|
class NonstoppingBackgroundWorker(BackgroundWorker):
|
||||||
|
|
|
@ -333,7 +333,7 @@ class PlexCompanion(backgroundthread.KillableThread):
|
||||||
try:
|
try:
|
||||||
message_count += 1
|
message_count += 1
|
||||||
if httpd:
|
if httpd:
|
||||||
if not thread.isAlive():
|
if not thread.is_alive():
|
||||||
# Use threads cause the method will stall
|
# Use threads cause the method will stall
|
||||||
thread = Thread(target=httpd.handle_request)
|
thread = Thread(target=httpd.handle_request)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
|
@ -377,7 +377,7 @@ def _pms_list_from_plex_tv(token):
|
||||||
while True:
|
while True:
|
||||||
# Remove finished threads
|
# Remove finished threads
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
if not thread.isAlive():
|
if not thread.is_alive():
|
||||||
threads.remove(thread)
|
threads.remove(thread)
|
||||||
if len(threads) < max_threads:
|
if len(threads) < max_threads:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -928,7 +928,7 @@ class PropertyTimer(object):
|
||||||
self._onTimeout()
|
self._onTimeout()
|
||||||
|
|
||||||
def _stopped(self):
|
def _stopped(self):
|
||||||
return not self._thread or not self._thread.isAlive()
|
return not self._thread or not self._thread.is_alive()
|
||||||
|
|
||||||
def _reset(self):
|
def _reset(self):
|
||||||
self._endTime = time.time() + self._timeout
|
self._endTime = time.time() + self._timeout
|
||||||
|
|
Loading…
Reference in a new issue