google-pubsub-enhancer 0.1.4 → 0.1.5

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: e657a0b10ebce1330b9195f68b30b936eb99d554
4
- data.tar.gz: 71b758294f17f45e75c13a10dcec95cf5e2930a5
3
+ metadata.gz: 0dc8568d671d6eab7c897c473d88ac3b650a144d
4
+ data.tar.gz: 37a518956fae4794e141190ecac3d7794916201e
5
5
  SHA512:
6
- metadata.gz: c104c12e93ddba540095e3498d2a8fed9821906ebc3a41419e62f86203bf5cbb496c96fa1fe7404486a164de17d69a2affb97fa2066a23b4e4bd1cf6a1b8c402
7
- data.tar.gz: ddd4ba14b6c55faf41330824c5231a56ce6faccedc25b7f57150c9fd77166b6bd67c984f2d00442161810e4b6db835d63c506e0b02d8531518b74763a49b7b60
6
+ metadata.gz: 149e0d2cc061f5c8ac057701df1ab148f0c443025716811a0605daedcd580d9eb5d9f5de9048335ccf26a3cc19ffb908ad637b15d715135bf5d97eb2a488b5e1
7
+ data.tar.gz: f9c3cd8304cafc902d7fde8cfb4c217f25b4804f33d138f692dd0034decaf4256288a528cd9444c7e0b08d3206c77b0cf66bb9513fadf04898af9e163e9b047f
data/README.md CHANGED
@@ -38,6 +38,10 @@ app.run(subscription_name)
38
38
 
39
39
  ```
40
40
 
41
+ ## ENV
42
+
43
+ To configure how much message should be pulled, use the GOOGLE_PUBSUB_ENHANCER_MAX_PULL_SIZE env variable with an integer value
44
+
41
45
  ## Development
42
46
 
43
47
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,8 @@
1
+ module GooglePubsubEnhancer::Constants
2
+ MAX_PULL_SIZE = proc do
3
+ user_defined = ::ENV['GOOGLE_PUBSUB_ENHANCER_MAX_PULL_SIZE']
4
+ pull_size = (user_defined || 100).to_i
5
+ raise('GOOGLE_PUBSUB_ENHANCER_MAX_PULL_SIZE') if pull_size == 0
6
+ pull_size
7
+ end.call.freeze
8
+ end
@@ -1,3 +1,3 @@
1
1
  class GooglePubsubEnhancer
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -4,6 +4,7 @@ require 'google/cloud/pubsub'
4
4
 
5
5
  class GooglePubsubEnhancer
6
6
 
7
+ require_relative 'google_pubsub_enhancer/constants'
7
8
  require_relative 'google_pubsub_enhancer/middleware'
8
9
 
9
10
  class << self
@@ -33,7 +34,7 @@ class GooglePubsubEnhancer
33
34
  private
34
35
 
35
36
  def work(subscription, opts)
36
- while received_messages = subscription.pull
37
+ while received_messages = subscription.pull(:max => GooglePubsubEnhancer::Constants::MAX_PULL_SIZE)
37
38
  break if opts[:shutdown].call || received_messages == nil
38
39
  next if received_messages.empty?
39
40
  @stack.call({received_messages: received_messages})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-pubsub-enhancer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bejczib
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-28 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,6 +99,7 @@ files:
99
99
  - bin/setup
100
100
  - google-pubsub-enhancer.gemspec
101
101
  - lib/google_pubsub_enhancer.rb
102
+ - lib/google_pubsub_enhancer/constants.rb
102
103
  - lib/google_pubsub_enhancer/middleware.rb
103
104
  - lib/google_pubsub_enhancer/middleware/logger.rb
104
105
  - lib/google_pubsub_enhancer/middleware/logger/duration.rb