Get rid of Semaphores completely.

This commit is contained in:
Simon 2021-01-27 18:54:31 +00:00
parent d3bc7fe5d8
commit 91fe2e6f9d
2 changed files with 0 additions and 6 deletions

View File

@ -493,11 +493,7 @@ def threadIdent():
def threadedMysql():
logger.debug('(MYSQL) Starting MySQL thread')
if not mysql_sema.acquire(blocking = False):
logger.debug('(MYSQL) Previous thread is still running (can\'t acquire semaphore). Try next iteration')
return
reactor.callInThread(mysqlGetConfig)
mysql_sema.release()
def ident():
for system in systems:
@ -1886,7 +1882,6 @@ if __name__ == '__main__':
#Mysql config checker
#This runs in a thread so as not to block the reactor
if CONFIG['MYSQL']['USE_MYSQL'] == True:
mysql_sema = Semaphore(value=1)
mysql_task = task.LoopingCall(threadedMysql)
mysql = mysql_task.start(30)
mysql.addErrback(loopingErrHandle)

View File

@ -35,7 +35,6 @@ from hashlib import sha256, sha1
from hmac import new as hmac_new, compare_digest
from time import time
from collections import deque
from threading import Semaphore
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import DatagramProtocol, Factory, Protocol