Commit 128e4541 authored by MAISSIAT's avatar MAISSIAT
Browse files

Fix #79: Add automatic vacuum for dcheck databases

Fix RabbitMQ ChannelWrongStateError exception
parent 410dc619
......@@ -114,7 +114,13 @@ class File(Base):
return vars(self)
def __repr__(self):
return "File(id_execution=%s, filename=%s, isDirectory=%s, isSymLink=%s, size=%s, mtime=%s, sensingtime=%s)" % (
return "File(id_execution=%s, " \
"filename=%s, " \
"isDirectory=%s, " \
"isSymLink=%s, " \
"size=%s, " \
"mtime=%s, " \
"sensingtime=%s)" % (
self.id_execution,
self.filename,
self.isDirectory,
......@@ -186,6 +192,11 @@ class SqliteBaseFilesInfos(object):
self.__sql_session = sessionmaker(bind=self.__sql_engine)()
self.__sql_session.execute('PRAGMA foreign_keys=ON')
vacuum = self.__sql_session.execute('select * from pragma_auto_vacuum').fetchall()
if vacuum[0][0] == 0:
self.__sql_session.execute('PRAGMA auto_vacuum=1')
self.__sql_session.execute('vacuum')
version = self.__sql_session \
.query(ConfigEntry) \
.filter(ConfigEntry.key == "version") \
......
......@@ -96,15 +96,14 @@ class PublishRabbitMQ():
body=json.dumps(message, default=customSerialize))
published = True
except (pika.exceptions.StreamLostError, pika.exceptions.ChannelWrongStateError):
except (pika.exceptions.StreamLostError, pika.exceptions.ChannelWrongStateError) as e:
if retry:
fail = True
raise
fail = True;
else:
connection = pika.BlockingConnection(pika.ConnectionParameters(**self.__connectionParams))
channel = connection.channel()
lastQueueName = None
connectionPool[threadID] = (connection, channel, lastQueueName)
self.__log.info("Try to write a message again")
self.__log.info(f"Try to write a message again (error {e})")
retry = True
......@@ -84,7 +84,7 @@ class WorkerUI(threading.Thread):
command = "celery"
argsList = [
# celery worker --config=(...).celery_config -l DEBUG -Q UI.hostname
# celery --config=(...).celery_config worker -l DEBUG -Q UI.hostname
'--config',
CONFIG_WORKER,
"--workdir",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment