Commit d764f5b1 authored by Stavros Sachtouris's avatar Stavros Sachtouris Committed by Giorgos Korfiatis
Browse files

Clean up DB when web protocol listener is closed

parent c1b845fa
......@@ -378,13 +378,15 @@ class WebSocketProtocol(WebSocket):
"""Stop server heart, empty DB and exit"""
LOG.debug('Stop protocol heart')
self.heart.stop()
self.clean_db()
def clean_db(self):
"""Clean DB from session traces"""
LOG.debug('Remove session traces')
self.db = sqlite3.connect(self.session_db)
self.db.execute('BEGIN')
self.db.execute('DELETE FROM %s' % self.session_relation)
self.db.commit()
self.db.close()
LOG.debug('Helper: connection closed')
def send_json(self, msg):
LOG.debug('send: %s' % msg)
......
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