[Groonga-commit] droonga/fluent-plugin-droonga at d7a6bd3 [master] Remove unsubscribed subscriber anyway if "query" is not specified

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Oct 31 12:47:24 JST 2013


YUKI Hiroshi	2013-10-31 12:47:24 +0900 (Thu, 31 Oct 2013)

  New Revision: d7a6bd3f779c47fcc51eb35657b6d9ce1020dfb6
  https://github.com/droonga/fluent-plugin-droonga/commit/d7a6bd3f779c47fcc51eb35657b6d9ce1020dfb6

  Message:
    Remove unsubscribed subscriber anyway if "query" is not specified

  Modified files:
    lib/droonga/watcher.rb

  Modified: lib/droonga/watcher.rb (+14 -9)
===================================================================
--- lib/droonga/watcher.rb    2013-10-31 12:42:30 +0900 (2650ece)
+++ lib/droonga/watcher.rb    2013-10-31 12:47:24 +0900 (e9ebf07)
@@ -55,22 +55,27 @@ module Droonga
 
     def unsubscribe(request)
       subscriber = request[:subscriber]
-      condition  = request[:condition]
       query      = request[:query]
 
-      query_table = @context["Query"]
-      query_record = query_table[query]
-      return unless query_record
       subscriber_table = @context["Subscriber"]
       subscriber_record = subscriber_table[subscriber]
       return unless subscriber_record
-      subscriptions = subscriber_record.subscriptions.select do |query|
-        query != query_record
-      end
-      if subscriptions.empty?
+
+      query_table = @context["Query"]
+      if query.nil?
         subscriber_record.delete
       else
-        subscriber_record.subscriptions = subscriptions
+        query_record = query_table[query]
+        return unless query_record
+
+        subscriptions = subscriber_record.subscriptions.select do |query|
+          query != query_record
+        end
+        if subscriptions.empty?
+          subscriber_record.delete
+        else
+          subscriber_record.subscriptions = subscriptions
+        end
       end
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index