thrift-amqp 0.1.0 → 0.1.2

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: bbcc7e5d11997a392f1d8fe4bc30aeec8157c5ac
4
- data.tar.gz: 4ae5438f06fabb60b70d8aac53a4f7807c049bcf
3
+ metadata.gz: 428c05f9bab14924247d57bf04fd47b6d17d8aff
4
+ data.tar.gz: e1831a4a4409ba080bae4f4ed6f01b25ca05df36
5
5
  SHA512:
6
- metadata.gz: 2c1821b53157ca602e782fccb638ee6d9ac9a03d99ebf1e2810e3ff62c21ff258843f57cb3efcf1fee1458f9121037b4df1f496150d29cacabc742e21e0c05f7
7
- data.tar.gz: dcf634025b9e07c3c809e70d01a855280b0ed8785550b32accd745b364663467c3cc655b1b6ddd818c345cfce45761158b9832d3a8d65bb05701c31fba68887d
6
+ metadata.gz: 248b0d14eb7fed9864bf011f37b95f8e5b45013c9336c44b8d84df8224031917c831ecfa3a0c307df927bfa0eb7dca07d26bc7564951d1fe748a43ad3c10fc15
7
+ data.tar.gz: fd608bd4df8fcc0c8e73df1be36ed3c1a05fd235def3d55b3c43e0c681a60281c6e2adcb79f41d5ad4dce6445832eeee3ccdc1bab3b7908edb61f23c02ea1a86
@@ -17,9 +17,10 @@ module Thrift
17
17
  @amqp_uri = opts[:amqp_uri]
18
18
  @routing_key = opts[:routing_key]
19
19
  @exchange_name = opts[:exchange_name]
20
- @prefetch = opts[:prefetch]
20
+ @prefetch = (ENV['QOS_SIZE'] || opts[:prefetch]).to_i
21
21
  @timeout = opts[:timeout]
22
22
  @consumer_tag = opts[:consumer_tag]
23
+ @fetching_disabled = ENV['RABBITMQ_QOS'] == '0'
23
24
  end
24
25
 
25
26
  def handle(delivery_info, properties, payload)
@@ -44,7 +45,7 @@ module Thrift
44
45
  end
45
46
 
46
47
  def serve
47
- @conn = Bunny.new(@amqp_uri)
48
+ @conn = Bunny.new(@amqp_uri, continuation_timeout: @timeout * 1000)
48
49
 
49
50
  @conn.start
50
51
  @channel = @conn.create_channel
@@ -57,6 +58,12 @@ module Thrift
57
58
  @channel.prefetch @prefetch
58
59
 
59
60
  loop do
61
+ if @fetching_disabled
62
+ LOGGER.info("Fetching disabled")
63
+ sleep @timeout
64
+ next
65
+ end
66
+
60
67
  LOGGER.info("Fetching message from #{@queue_name}")
61
68
  queue.subscribe(
62
69
  manual_ack: true,
@@ -1,5 +1,5 @@
1
1
  module Thrift
2
2
  module AMQP
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrift-amqp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Montagne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler