about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorClworld <clworld@ggtea.org>2017-05-29 02:14:44 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-28 19:14:44 +0200
commit45837c533e2d2bd0dd7ecde8c192a1af682be6cf (patch)
treed792f0357b571da04d04e83dfd7b4d38341eaddc /streaming
parent3fa8512474137e84cfaf37682e78a84995e5c862 (diff)
Re-add stream end log for WebSocket (#3397)
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 5c050fd2b..52b5ccced 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -315,12 +315,14 @@ const startWorker = (workerId) => {
   };
 
   // Setup stream end for WebSockets
-  const streamWsEnd = ws => (id, listener) => {
+  const streamWsEnd = (req, ws) => (id, listener) => {
     ws.on('close', () => {
+      log.verbose(req.requestId, `Ending stream for ${req.accountId}`);
       unsubscribe(id, listener);
     });
 
     ws.on('error', e => {
+      log.verbose(req.requestId, `Ending stream for ${req.accountId}`);
       unsubscribe(id, listener);
     });
   };
@@ -370,19 +372,19 @@ const startWorker = (workerId) => {
 
       switch(location.query.stream) {
       case 'user':
-        streamFrom(`timeline:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(ws));
+        streamFrom(`timeline:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(req, ws));
         break;
       case 'public':
-        streamFrom('timeline:public', req, streamToWs(req, ws), streamWsEnd(ws), true);
+        streamFrom('timeline:public', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
         break;
       case 'public:local':
-        streamFrom('timeline:public:local', req, streamToWs(req, ws), streamWsEnd(ws), true);
+        streamFrom('timeline:public:local', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
         break;
       case 'hashtag':
-        streamFrom(`timeline:hashtag:${location.query.tag}`, req, streamToWs(req, ws), streamWsEnd(ws), true);
+        streamFrom(`timeline:hashtag:${location.query.tag}`, req, streamToWs(req, ws), streamWsEnd(req, ws), true);
         break;
       case 'hashtag:local':
-        streamFrom(`timeline:hashtag:${location.query.tag}:local`, req, streamToWs(req, ws), streamWsEnd(ws), true);
+        streamFrom(`timeline:hashtag:${location.query.tag}:local`, req, streamToWs(req, ws), streamWsEnd(req, ws), true);
         break;
       default:
         ws.close();