From 3b54213e97c983e584d4ccea2d3ba2b1c0a1871c Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Fri, 21 Feb 2014 12:00:46 +0900 Subject: [PATCH] Leave transaction channel when it's done. Could be made cleaner if more code was moved to the app side. --- lib/roles/app.js | 4 +++- res/app/components/stf/control/transaction-service.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/roles/app.js b/lib/roles/app.js index c6c76145..7260bbe7 100644 --- a/lib/roles/app.js +++ b/lib/roles/app.js @@ -258,7 +258,6 @@ module.exports = function(options) { socket.emit('tx.progress', channel.toString(), message) }) .on(wire.TransactionDoneMessage, function(channel, message) { - //leaveChannel(channel) socket.emit('tx.done', channel.toString(), message) }) .handler() @@ -323,6 +322,9 @@ module.exports = function(options) { ]) }) // Transactions + .on('tx.cleanup', function(channel) { + leaveChannel(channel) + }) .on('shell.command', function(channel, responseChannel, data) { joinChannel(responseChannel) push.send([ diff --git a/res/app/components/stf/control/transaction-service.js b/res/app/components/stf/control/transaction-service.js index 99741626..96097442 100644 --- a/res/app/components/stf/control/transaction-service.js +++ b/res/app/components/stf/control/transaction-service.js @@ -39,9 +39,9 @@ module.exports = function TransactionServiceFactory(socket) { .finally(function() { socket.removeListener('tx.done', doneListener) socket.removeListener('tx.progress', progressListener) + socket.emit('tx.cleanup', channel) }) .progressed(function() { - console.log('progressing') return results }) .then(function() {