[Groonga-commit] droonga/droonga-client-ruby at ea11dcb [master] Support break in the callback for client.request

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu May 7 16:48:49 JST 2015


YUKI Hiroshi	2015-05-07 16:48:49 +0900 (Thu, 07 May 2015)

  New Revision: ea11dcbe61d7f7ca156b7918c7f03032213ad8dc
  https://github.com/droonga/droonga-client-ruby/commit/ea11dcbe61d7f7ca156b7918c7f03032213ad8dc

  Message:
    Support break in the callback for client.request

  Modified files:
    bin/droonga-request
    lib/droonga/client/connection/http.rb

  Modified: bin/droonga-request (+1 -1)
===================================================================
--- bin/droonga-request    2015-05-07 13:36:02 +0900 (a915cee)
+++ bin/droonga-request    2015-05-07 16:48:49 +0900 (7b9ab35)
@@ -150,7 +150,7 @@ json_parser.on_parse_complete = lambda do |request_message|
     end
     message << "\n"
     print(message)
-    client.close if options[:exit_on_response]
+    break if options[:exit_on_response]
   end
   request.wait
 end

  Modified: lib/droonga/client/connection/http.rb (+6 -0)
===================================================================
--- lib/droonga/client/connection/http.rb    2015-05-07 13:36:02 +0900 (b743e23)
+++ lib/droonga/client/connection/http.rb    2015-05-07 16:48:49 +0900 (c82cb26)
@@ -86,12 +86,18 @@ module Droonga
               response.body
             end
           else
+            catch do |tag|
             thread = Thread.new do
               send(message, options) do |response|
+                begin
                 yield(response.body)
+                rescue LocalJumpError
+                  throw(tag)
+                end
               end
             end
             Request.new(thread)
+            end
           end
         end
 
-------------- next part --------------
HTML����������������������������...
Download 



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