Просмотр исходного кода

clarify errors for subscribe/unsubscribe

Brian Gough 7 лет назад
Родитель
Сommit
3bf5dd5d6b
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      services/real-time/app/coffee/ChannelManager.coffee

+ 4 - 4
services/real-time/app/coffee/ChannelManager.coffee

@@ -16,9 +16,9 @@ module.exports = ChannelManager =
         existingChannelSet = ClientMap.get(rclient) || @_createNewClientEntry(rclient)
         existingChannelSet = ClientMap.get(rclient) || @_createNewClientEntry(rclient)
         channel = "#{baseChannel}:#{id}"
         channel = "#{baseChannel}:#{id}"
         if existingChannelSet.has(channel)
         if existingChannelSet.has(channel)
-            logger.error {channel}, "already subscribed"
+            logger.error {channel}, "already subscribed - shouldn't happen"
         else
         else
-            rclient.subscribe channel
+            rclient.subscribe channel # completes in the background
             existingChannelSet.add(channel)
             existingChannelSet.add(channel)
             logger.log {channel}, "subscribed to new channel"
             logger.log {channel}, "subscribed to new channel"
             metrics.inc "subscribe.#{baseChannel}"
             metrics.inc "subscribe.#{baseChannel}"
@@ -27,9 +27,9 @@ module.exports = ChannelManager =
         existingChannelSet = ClientMap.get(rclient)
         existingChannelSet = ClientMap.get(rclient)
         channel = "#{baseChannel}:#{id}"
         channel = "#{baseChannel}:#{id}"
         if !existingChannelSet.has(channel)
         if !existingChannelSet.has(channel)
-            logger.error {channel}, "not subscribed, cannot unsubscribe"
+            logger.error {channel}, "not subscribed - shouldn't happen"
         else
         else
-            rclient.unsubscribe channel
+            rclient.unsubscribe channel # completes in the background
             existingChannelSet.delete(channel)
             existingChannelSet.delete(channel)
             logger.log {channel}, "unsubscribed from channel"
             logger.log {channel}, "unsubscribed from channel"
             metrics.inc "unsubscribe.#{baseChannel}"
             metrics.inc "unsubscribe.#{baseChannel}"