Commit 4ebe0b4e authored by Ossi Laine's avatar Ossi Laine
Browse files

TODO comment for unfinished business

parent c77bf75b
...@@ -1060,18 +1060,13 @@ def create_embody(meta): ...@@ -1060,18 +1060,13 @@ def create_embody(meta):
emit('end', {'path': img_path}) emit('end', {'path': img_path})
@socketio.on('end', namespace="/create_embody")
def end_create_embody():
db.session.close()
@socketio.on('connect', namespace="/download_csv") @socketio.on('connect', namespace="/download_csv")
def start_download_csv(): def start_download_csv():
emit('success', {'connection': 'Start generating CSV file'}) emit('success', {'connection': 'Start generating CSV file'})
@socketio.on('generate_csv', namespace="/download_csv") @socketio.on('generate_csv', namespace="/download_csv")
def process_download_csv(meta): def download_csv(meta):
exp_id = meta["exp_id"] exp_id = meta["exp_id"]
data = generate_csv(exp_id) data = generate_csv(exp_id)
...@@ -1096,4 +1091,11 @@ def process_download_csv(meta): ...@@ -1096,4 +1091,11 @@ def process_download_csv(meta):
@socketio.on('end', namespace="/download_csv") @socketio.on('end', namespace="/download_csv")
def end_download_csv(): def end_download_csv():
# TODO: not working solution... db session keeps hanging after socket session has ended
# mysqld timeout is set to 180s, so it kills hanging connections, but this is not a good solution
db.session.close()
@socketio.on('end', namespace="/create_embody")
def end_create_embody():
db.session.close() db.session.close()
...@@ -26,6 +26,7 @@ $(document).ready(function()  { ...@@ -26,6 +26,7 @@ $(document).ready(function()  {
socket.on('timeout', function(data) { socket.on('timeout', function(data) {
// kill connection // kill connection
socket.emit('end') socket.emit('end')
socket.disconnect() socket.disconnect()
...@@ -39,6 +40,8 @@ $(document).ready(function()  { ...@@ -39,6 +40,8 @@ $(document).ready(function()  {
}); });
socket.on('file_ready', function(file) { socket.on('file_ready', function(file) {
socket.emit('end')
socket.disconnect() socket.disconnect()
exportButton.text('File is ready!') exportButton.text('File is ready!')
......
...@@ -142,6 +142,7 @@ select distinct p.idpage, q.idquestion from question q join page p on p.experime ...@@ -142,6 +142,7 @@ select distinct p.idpage, q.idquestion from question q join page p on p.experime
''' '''
@timeit @timeit
def generate_csv(exp_id): def generate_csv(exp_id):
......
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