webload-client 0.12.0 → 0.13.0

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
  SHA256:
3
- metadata.gz: '0552921ddebd940c8af597268272f1f183c9d2462c58f116fbaba9e2d6d58f79'
4
- data.tar.gz: 3ff16c40d25e0f436be0f02caeacf83c3a3cca5a8cd411d11b9b6fe3999863c2
3
+ metadata.gz: d4230895ba9cdcdd37b93df267eef8a370dae26dc9db6c2544e598efffd56190
4
+ data.tar.gz: 0dbb4ab016509506bc1a6210afd6dbd79e4cf62d89cfe3676a0133beee628822
5
5
  SHA512:
6
- metadata.gz: 844a7a958c44519d6410d357a316159081d813b9f1fa0c01d14dbd540253a78b06528394abdb8976f1b095726044f417efdad1ba7bc688f37d6bbfc674d9df50
7
- data.tar.gz: 79838781c1f4dbf4907d9551d27a8966861309c411e4e66340b58252ea2e6ef026be2eb32e7600e5fc034277c1c2a0ee30a268faf51b0d283ad5693343828c51
6
+ metadata.gz: 2808a6e2ffc1a624d985ea840f8ae713f5952ec1091f33aeb5ff657fc8a276fff38c60a1a327dfd0033b1e059533bb0af153c7d211860002c15760e599f6e0f3
7
+ data.tar.gz: a5a037d273115b4686fd654ee864dd095c4ff95024999da784f27d9ff0b82b1a49ffad1753b4ea4281d384a17ac52673b2008c44187148460b2a231b43ce20d3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webload-client (0.12.0)
4
+ webload-client (0.13.0)
5
5
  aws-sdk-sqs
6
6
 
7
7
  GEM
@@ -28,6 +28,12 @@ module Webload
28
28
  next if method.nil?
29
29
  next if $options.ignore && uri.match(/#{$options.ignore}/)
30
30
 
31
+ # rate is 60 / requests per minute divided by
32
+ # interval is the difference between Time.now - time (Time.now at some time)
33
+ # Rate 0 is send all messages
34
+ # 60 RPM => rate = 1, so only after interval (time elapsed) is greater than rate
35
+ # send the request and reset time. So only after the interval is greater than 1 second
36
+ # 120 RPM => rate = 0.5, so only after 0.5 seconds passed, send the request.
31
37
  if interval > rate
32
38
  time = Time.now
33
39
  request = URI.join($options.url, uri)
@@ -44,8 +50,11 @@ module Webload
44
50
 
45
51
  $logger.debug('New message: ' + message)
46
52
 
47
- entries << {id: entries.size.to_s, message_body: message}
48
- if entries.size == $options.batch
53
+ $options.multiply_by.times.each_with_index do |index|
54
+ entries << {id: entries.size.to_s, message_body: message}
55
+ end
56
+
57
+ if entries.size == ($options.batch * $options.multiply_by)
49
58
  $client.send_message_batch(queue_url: $queue, entries: entries)
50
59
  $logger.debug('Batch messages sent to SQS')
51
60
  entries = []
@@ -33,6 +33,10 @@ module Webload
33
33
  options.ignore = v
34
34
  end
35
35
 
36
+ opts.on("-m", "--multiply-by NUM", "Multiply the number of requests by a factor of") do |v|
37
+ options.multiply_by = v.to_i
38
+ end
39
+
36
40
  opts.separator ""
37
41
 
38
42
  opts.on_tail("-v", "--verbose", "Run verbosely") do |v|
@@ -48,6 +52,7 @@ module Webload
48
52
  # Default values
49
53
  options.rpm ||= 0
50
54
  options.batch ||= 1
55
+ options.multiply_by ||= 1
51
56
 
52
57
  # Parse and return options
53
58
  parser.parse!(args)
@@ -1,5 +1,5 @@
1
1
  module Webload
2
2
  module Client
3
- VERSION = "0.12.0"
3
+ VERSION = "0.13.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webload-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger