Get rid of Semaphores completely.
This commit is contained in:
parent
d3bc7fe5d8
commit
91fe2e6f9d
@ -493,11 +493,7 @@ def threadIdent():
|
|||||||
|
|
||||||
def threadedMysql():
|
def threadedMysql():
|
||||||
logger.debug('(MYSQL) Starting MySQL thread')
|
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)
|
reactor.callInThread(mysqlGetConfig)
|
||||||
mysql_sema.release()
|
|
||||||
|
|
||||||
def ident():
|
def ident():
|
||||||
for system in systems:
|
for system in systems:
|
||||||
@ -1886,7 +1882,6 @@ if __name__ == '__main__':
|
|||||||
#Mysql config checker
|
#Mysql config checker
|
||||||
#This runs in a thread so as not to block the reactor
|
#This runs in a thread so as not to block the reactor
|
||||||
if CONFIG['MYSQL']['USE_MYSQL'] == True:
|
if CONFIG['MYSQL']['USE_MYSQL'] == True:
|
||||||
mysql_sema = Semaphore(value=1)
|
|
||||||
mysql_task = task.LoopingCall(threadedMysql)
|
mysql_task = task.LoopingCall(threadedMysql)
|
||||||
mysql = mysql_task.start(30)
|
mysql = mysql_task.start(30)
|
||||||
mysql.addErrback(loopingErrHandle)
|
mysql.addErrback(loopingErrHandle)
|
||||||
|
@ -35,7 +35,6 @@ from hashlib import sha256, sha1
|
|||||||
from hmac import new as hmac_new, compare_digest
|
from hmac import new as hmac_new, compare_digest
|
||||||
from time import time
|
from time import time
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from threading import Semaphore
|
|
||||||
|
|
||||||
# Twisted is pretty important, so I keep it separate
|
# Twisted is pretty important, so I keep it separate
|
||||||
from twisted.internet.protocol import DatagramProtocol, Factory, Protocol
|
from twisted.internet.protocol import DatagramProtocol, Factory, Protocol
|
||||||
|
Loading…
x
Reference in New Issue
Block a user