@@ -45,6 +45,19 @@ module HTTP
45
45
class Manticore
46
46
include Base
47
47
48
+ def initialize ( arguments = { } , &block )
49
+ @manticore = build_client ( arguments [ :options ] || { } )
50
+ super ( )
51
+ end
52
+
53
+ # Should just be run once at startup
54
+ def build_client ( options = { } )
55
+ client_options = options [ :transport_options ] || { }
56
+ client_options [ :ssl ] = options [ :ssl ] || { }
57
+
58
+ @manticore = ::Manticore ::Client . new ( client_options )
59
+ end
60
+
48
61
# Performs the request by invoking {Transport::Base#perform_request} with a block.
49
62
#
50
63
# @return [Response]
@@ -84,9 +97,6 @@ def __build_connections
84
97
@request_options [ :headers ] = options [ :headers ]
85
98
end
86
99
87
- client_options = options [ :transport_options ] || { }
88
- client_options [ :ssl ] = options [ :ssl ] || { }
89
-
90
100
Connections ::Collection . new \
91
101
:connections => hosts . map { |host |
92
102
host [ :protocol ] = host [ :scheme ] || DEFAULT_PROTOCOL
@@ -95,11 +105,9 @@ def __build_connections
95
105
host . delete ( :user ) # auth is not supported here.
96
106
host . delete ( :password ) # use the headers
97
107
98
- url = __full_url ( host )
99
-
100
108
Connections ::Connection . new \
101
109
:host => host ,
102
- :connection => :: Manticore :: Client . new ( client_options )
110
+ :connection => @manticore
103
111
} ,
104
112
:selector_class => options [ :selector_class ] ,
105
113
:selector => options [ :selector ]
0 commit comments