完善功能:数据库超时等待

This commit is contained in:
Qiea
2024-12-22 12:31:29 +08:00
parent 1d534be4c1
commit 5a82462cac
6 changed files with 103 additions and 40 deletions

14
main.py
View File

@@ -1,4 +1,4 @@
from Thread import UploadThread, FindThread, ByNetFindThread
from Thread import UploadThread, FindThread, ByNetFindThread, MySQLConnectionPool
from Tools import imagehash, Image, os, config
type = int(config['settings']['type'])
@@ -12,8 +12,10 @@ if not os.path.exists('img'):
if __name__ == '__main__':
pool = MySQLConnectionPool()
if type == 1:
Thread = FindThread(TargetImageHash)
Thread = FindThread(TargetImageHash, pool)
Thread.start()
elif type == 2:
@@ -24,12 +26,6 @@ if __name__ == '__main__':
elif type == 3:
while baseArr <= TargetRange[1]:
Thread = UploadThread(baseArr)
Thread.start()
baseArr += 1
Thread = UploadThread(baseArr)
Thread.start()
baseArr += 1
Thread = UploadThread(baseArr)
Thread = UploadThread(baseArr, pool)
Thread.start()
baseArr += 1