lock=threading.RLock()# doufam, ze kdyz je lock tady, ze je funknci. Closure...? XX nejak otestovat
THUMBNAIL_SIZE=640,640
...
...
@@ -21,7 +23,7 @@ class Config:
defconnect():
# XX resim problem peewee.OperationalError: (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'))") po 7 hodinach timeoutu
# XX kupodivu pripojeni nemuze byt v dbp DBModel.connect. Prestoze type je pak spravne (MySQLDatabase), nic udelat nejde a pokusy o select konci NoneType.
print("Connecting to DB.")
logging.debug("Connecting to DB.")
Config.myDB=MySQLDatabase("mdmaug",host='localhost',port=3306,user="mdmaug",passwd="fidFDSs676")# XX dal jsem pryc: , threadlocals=False
whileos.path.isfile(logfile)==False:# i po zavreni FF nekdy trva, nez se soubor zapise
expiration+=1
print("({}) waiting to close...".format(self.profile))
logging.debug("({}) waiting to close...".format(self.profile))
ifexpiration>Config.MAX_BROWSER_EXPIRATION:
print("({}) time is run!".format(self.profile))
logging.debug("({}) time is run!".format(self.profile))
raiseFileNotFoundError("time is run - browser expired")
time.sleep(1)
...
...
@@ -179,23 +168,23 @@ class ScanController:
defdump():
withopen(Config.configFile,'w')asf:
json.dump(self.queueFF,f)
#print("UNKBOOK")
#logging.debug("UNKBOOK")
try:
self.queueFF.pop(self.profile)
dump()
exceptKeyError:
print("Unbook failed")
print(self.queueFF)
logging.debug("Unbook failed")
logging.debug(self.queueFF)
raise
exceptOSError:
print("({}) OS Error - interferuje s pustenym FF, ktere zere prilis pameti. Zkusime pockat.".format(self.profile))
logging.debug("({}) OS Error - interferuje s pustenym FF, ktere zere prilis pameti. Zkusime pockat.".format(self.profile))
time.sleep(10)# XX jestli funkcionalitu zachovat, dat sem pocitadlo, at je na konzoli videt akce
try:
dump()
exceptOSError:
print("({}) System se nezotavil.".format(self.profile))
logging.debug("({}) System se nezotavil.".format(self.profile))
return"Memory may be exhausted. See mdmaug-server/scan_controller.py for details."# FF sezral vsechnu pamet asi. Stranka je problematicka. UrlQuery podle me taky selze.