Add message time logging lock

This commit is contained in:
Fierelier 2020-11-25 20:56:38 +01:00
parent 3684843143
commit 276e112156
1 changed files with 3 additions and 0 deletions

View File

@ -621,11 +621,14 @@ def getLastMessageTime(channel):
if not os.path.isfile(mtpath): return None
return dtFromString(open(mtpath,"r").read())
msgTimeLock = threading.Lock()
def setLastMessageTime(channel,time):
msgTimeLock.acquire()
mtpath = getMessageTimePath(channel)
fh = open(mtpath,"w")
fh.write(dtToString(time))
fh.close()
msgTimeLock.release()
def discordClient(token):
logging.basicConfig(level=logging.INFO)