is_alive replaces isAlive

merge-requests/8/head
Bob Mottram 2020-12-18 15:29:12 +00:00
parent 347626fd8a
commit bb31ce37cd
5 changed files with 27 additions and 27 deletions

View File

@ -1012,7 +1012,7 @@ class PubServer(BaseHTTPRequestHandler):
print('Waiting for previous outbox thread to end')
waitCtr = 0
thName = accountOutboxThreadName
while self.server.outboxThread[thName].isAlive() and waitCtr < 8:
while self.server.outboxThread[thName].is_alive() and waitCtr < 8:
time.sleep(1)
waitCtr += 1
if waitCtr >= 8:
@ -12087,7 +12087,7 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.newPostThread.get(newPostThreadName):
print('Waiting for previous new post thread to end')
waitCtr = 0
while (self.server.newPostThread[newPostThreadName].isAlive() and
while (self.server.newPostThread[newPostThreadName].is_alive() and
waitCtr < 8):
time.sleep(1)
waitCtr += 1
@ -13005,7 +13005,7 @@ def runPostsWatchdog(projectVersion: str, httpd) -> None:
httpd.thrPostsQueue.start()
while True:
time.sleep(20)
if not httpd.thrPostsQueue.isAlive():
if not httpd.thrPostsQueue.is_alive():
httpd.thrPostsQueue.kill()
httpd.thrPostsQueue = postsQueueOriginal.clone(runPostsQueue)
httpd.thrPostsQueue.start()
@ -13020,7 +13020,7 @@ def runSharesExpireWatchdog(projectVersion: str, httpd) -> None:
httpd.thrSharesExpire.start()
while True:
time.sleep(20)
if not httpd.thrSharesExpire.isAlive():
if not httpd.thrSharesExpire.is_alive():
httpd.thrSharesExpire.kill()
httpd.thrSharesExpire = sharesExpireOriginal.clone(runSharesExpire)
httpd.thrSharesExpire.start()

View File

@ -2456,7 +2456,7 @@ def runInboxQueueWatchdog(projectVersion: str, httpd) -> None:
httpd.thrInboxQueue.start()
while True:
time.sleep(20)
if not httpd.thrInboxQueue.isAlive() or httpd.restartInboxQueue:
if not httpd.thrInboxQueue.is_alive() or httpd.restartInboxQueue:
httpd.restartInboxQueueInProgress = True
httpd.thrInboxQueue.kill()
httpd.thrInboxQueue = inboxQueueOriginal.clone(runInboxQueue)

View File

@ -752,7 +752,7 @@ def runNewswireWatchdog(projectVersion: str, httpd) -> None:
httpd.thrNewswireDaemon.start()
while True:
time.sleep(50)
if not httpd.thrNewswireDaemon.isAlive():
if not httpd.thrNewswireDaemon.is_alive():
httpd.thrNewswireDaemon.kill()
httpd.thrNewswireDaemon = \
newswireOriginal.clone(runNewswireDaemon)

View File

@ -158,7 +158,7 @@ def runPostScheduleWatchdog(projectVersion: str, httpd) -> None:
httpd.thrPostSchedule.start()
while True:
time.sleep(20)
if not httpd.thrPostSchedule.isAlive():
if not httpd.thrPostSchedule.is_alive():
httpd.thrPostSchedule.kill()
httpd.thrPostSchedule = \
postScheduleOriginal.clone(runPostSchedule)

View File

@ -236,11 +236,11 @@ def testThreads():
args=('test',),
daemon=True)
thr.start()
assert thr.isAlive() is True
assert thr.is_alive() is True
time.sleep(1)
thr.kill()
thr.join()
assert thr.isAlive() is False
assert thr.is_alive() is False
def createServerAlice(path: str, domain: str, port: int,
@ -462,7 +462,7 @@ def testPostMessageBetweenServers():
global thrAlice
if thrAlice:
while thrAlice.isAlive():
while thrAlice.is_alive():
thrAlice.stop()
time.sleep(1)
thrAlice.kill()
@ -476,7 +476,7 @@ def testPostMessageBetweenServers():
global thrBob
if thrBob:
while thrBob.isAlive():
while thrBob.is_alive():
thrBob.stop()
time.sleep(1)
thrBob.kill()
@ -490,8 +490,8 @@ def testPostMessageBetweenServers():
thrAlice.start()
thrBob.start()
assert thrAlice.isAlive() is True
assert thrBob.isAlive() is True
assert thrAlice.is_alive() is True
assert thrBob.is_alive() is True
# wait for both servers to be running
while not (testServerAliceRunning and testServerBobRunning):
@ -690,11 +690,11 @@ def testPostMessageBetweenServers():
# stop the servers
thrAlice.kill()
thrAlice.join()
assert thrAlice.isAlive() is False
assert thrAlice.is_alive() is False
thrBob.kill()
thrBob.join()
assert thrBob.isAlive() is False
assert thrBob.is_alive() is False
os.chdir(baseDir)
shutil.rmtree(aliceDir)
@ -733,7 +733,7 @@ def testFollowBetweenServers():
global thrAlice
if thrAlice:
while thrAlice.isAlive():
while thrAlice.is_alive():
thrAlice.stop()
time.sleep(1)
thrAlice.kill()
@ -747,7 +747,7 @@ def testFollowBetweenServers():
global thrBob
if thrBob:
while thrBob.isAlive():
while thrBob.is_alive():
thrBob.stop()
time.sleep(1)
thrBob.kill()
@ -761,8 +761,8 @@ def testFollowBetweenServers():
thrAlice.start()
thrBob.start()
assert thrAlice.isAlive() is True
assert thrBob.isAlive() is True
assert thrAlice.is_alive() is True
assert thrBob.is_alive() is True
# wait for all servers to be running
ctr = 0
@ -862,11 +862,11 @@ def testFollowBetweenServers():
# stop the servers
thrAlice.kill()
thrAlice.join()
assert thrAlice.isAlive() is False
assert thrAlice.is_alive() is False
thrBob.kill()
thrBob.join()
assert thrBob.isAlive() is False
assert thrBob.is_alive() is False
# queue item removed
time.sleep(4)
@ -1290,7 +1290,7 @@ def testClientToServer():
global thrAlice
if thrAlice:
while thrAlice.isAlive():
while thrAlice.is_alive():
thrAlice.stop()
time.sleep(1)
thrAlice.kill()
@ -1304,7 +1304,7 @@ def testClientToServer():
global thrBob
if thrBob:
while thrBob.isAlive():
while thrBob.is_alive():
thrBob.stop()
time.sleep(1)
thrBob.kill()
@ -1318,8 +1318,8 @@ def testClientToServer():
thrAlice.start()
thrBob.start()
assert thrAlice.isAlive() is True
assert thrBob.isAlive() is True
assert thrAlice.is_alive() is True
assert thrBob.is_alive() is True
# wait for both servers to be running
ctr = 0
@ -1614,11 +1614,11 @@ def testClientToServer():
# stop the servers
thrAlice.kill()
thrAlice.join()
assert thrAlice.isAlive() is False
assert thrAlice.is_alive() is False
thrBob.kill()
thrBob.join()
assert thrBob.isAlive() is False
assert thrBob.is_alive() is False
os.chdir(baseDir)
# shutil.rmtree(aliceDir)