cql-rb 2.1.0.pre0 → 2.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f408afa031a9e58aebb3be39e8d0c0d2b0ad33b
4
- data.tar.gz: 7312ad424a8fd77f81af3cbb356018a7a5154d3a
3
+ metadata.gz: 2a2e1e800f2f73c9c9dd0c2beedaf55851174362
4
+ data.tar.gz: bf02fef5b52739fd1954f3ffcc4322a5c7ff1c01
5
5
  SHA512:
6
- metadata.gz: 774a0d581565ad62dbb963e77811431aeb360ec54fea83ec0bba98fe3502e4de076db0bdf9b67494da0b624e5d773c58fd13ae6e0f62b733b749b5392043bf83
7
- data.tar.gz: 012108242af73ebc3c32d17016e1fcd1667c4b1c16b25206ad6fa462e5c7e04d4848f24649881711089e6d9dcc40eb76d2639082966e64f6da5364bc29ef6ba1
6
+ metadata.gz: edfc218ddb4b1b5b1ca3f8d0a4fd0888e9bfa9bdc9b1ac974cf881e1dc9b853adc44d5b940fe3f953d6647beac297f99d8614fd36e1dc8ad1892fde752f2e9f1
7
+ data.tar.gz: f6ced79805a70ea44f4b3844480f56dbbd82bcbaaacbe86c2ad75725e9563d5c5f2d78a08d15bfd763ec4964251c1461eadb9f4cfde4112b0841729deba7bfc5
@@ -203,7 +203,6 @@ module Cql
203
203
  complete_request(id, @current_frame.body)
204
204
  end
205
205
  @current_frame = @frame_decoder.decode_frame(@read_buffer)
206
- flush_request_queue
207
206
  end
208
207
  end
209
208
 
@@ -233,6 +232,7 @@ module Cql
233
232
  if response.is_a?(Protocol::SetKeyspaceResultResponse)
234
233
  @keyspace = response.keyspace
235
234
  end
235
+ flush_request_queue
236
236
  unless promise.timed_out?
237
237
  promise.fulfill(response)
238
238
  end
@@ -256,7 +256,7 @@ module Cql
256
256
  if @request_queue_out.any? && (id = next_stream_id)
257
257
  promise = @request_queue_out.shift
258
258
  if promise.timed_out?
259
- id = nil
259
+ next
260
260
  else
261
261
  frame = promise.frame
262
262
  @promises[id] = promise
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Cql
4
- VERSION = '2.1.0.pre0'.freeze
4
+ VERSION = '2.1.0.pre1'.freeze
5
5
  end
@@ -112,6 +112,16 @@ module Cql
112
112
  futures[128].should be_resolved
113
113
  end
114
114
 
115
+ it 'flushes the request queue before it resolves the future of the just completed request' do
116
+ connection.stub(:write)
117
+ futures = Array.new(130) { protocol_handler.send_request(request) }
118
+ f = futures[0].map do
119
+ connection.should have_received(:write).exactly(129).times
120
+ end
121
+ connection.data_listener.call([0x81, 0, 0, 2, 0].pack('C4N'))
122
+ f.value
123
+ end
124
+
115
125
  context 'when a compressor is specified' do
116
126
  let :protocol_handler do
117
127
  described_class.new(connection, scheduler, 1, compressor)
@@ -248,6 +258,27 @@ module Cql
248
258
  128.times { |i| connection.data_listener.call([0x81, 0, i, 2, 0].pack('C4N')) }
249
259
  write_count.should == 128
250
260
  end
261
+
262
+ it 'does not stop sending queued requests even when one has timed out' do
263
+ write_count = 0
264
+ connection.stub(:write) do |s, &h|
265
+ write_count += 1
266
+ if h
267
+ h.call(buffer)
268
+ else
269
+ buffer << s
270
+ end
271
+ end
272
+ 128.times do
273
+ protocol_handler.send_request(request)
274
+ end
275
+ scheduler.stub(:schedule_timer).with(5).and_return(timer_promise.future)
276
+ f1 = protocol_handler.send_request(request, 5)
277
+ f2 = protocol_handler.send_request(request)
278
+ timer_promise.fulfill
279
+ connection.data_listener.call([0x81, 0, 0, 2, 0].pack('C4N'))
280
+ write_count.should == 129
281
+ end
251
282
  end
252
283
  end
253
284
 
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre0
4
+ version: 2.1.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Hultberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-11 00:00:00.000000000 Z
11
+ date: 2014-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ione
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.2.0.pre3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.2.0.pre3
27
27
  description: A pure Ruby CQL3 driver for Cassandra