Change thread.isAlive to thread.is_alive

This commit is contained in:
Nyaran 2021-01-05 14:11:27 +01:00
parent c6291eaba6
commit 48034d60ed
No known key found for this signature in database
GPG key ID: 1B81CBDA082BE524
4 changed files with 6 additions and 6 deletions

View file

@ -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):

View file

@ -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()

View file

@ -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:

View file

@ -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