blackstack_commons 1.1.10 → 1.1.11

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: 2e9df93155dc46a4db2e702f2ede6af77151f1bd
4
- data.tar.gz: 12ad3c508f8343d9983e11b20d0ca4bc365f684d
3
+ metadata.gz: 138ed01e758c54c9c961aea4fc2eda4883a1c735
4
+ data.tar.gz: 3923a2a75d8a5bb19c4de591b92a919941cb66b0
5
5
  SHA512:
6
- metadata.gz: 3724c7beea130aa65abb01f911840b6b3a51f4cde56591279a927aa6ab26e65f9f9196706384fa3affb32ed54c1116f586be2192ee8980212ac53bfecf02abea
7
- data.tar.gz: 15a760c7e6efc160bf83704198cc9bc62674110d5782a0eacef78d5483cdfc46973b651edbe8755c6ca9be722b582b41575bc4d23f3508223b4bf766d11295b3
6
+ metadata.gz: 927363454d10c1d0333976222e60bfed35febe3f3dfeaaf9fa676f58e20388f17349743e3eb3660b07879f1831b5b4ddf9875fd22736ca669a8bcb8dd586ffbe
7
+ data.tar.gz: dfb5bfa4a89f35fa6ff2a4bc3a9159058188013fc7dcfc1b266a660bf1d1e83e65923cb9fae9587db30ebfa747dc39078f42f0dd9671e55ab7e531f8dd0f9053
@@ -23,3 +23,21 @@ require_relative './extend_datetime'
23
23
  require_relative './extend_fixnum'
24
24
  require_relative './extend_float'
25
25
  require_relative './extend_exception'
26
+
27
+ module BlackStack
28
+
29
+ module Commons
30
+
31
+ @@max_api_call_channels = 10
32
+
33
+ def self.max_api_call_channels()
34
+ @@max_api_call_channels
35
+ end
36
+
37
+ def self.set(h)
38
+ @@max_api_call_channels = h[:max_api_call_channels]
39
+ end
40
+
41
+ end # module Commons
42
+
43
+ end # module BlackStack
data/lib/functions.rb CHANGED
@@ -497,10 +497,10 @@ module BlackStack
497
497
  # ssl_verify_mode: you can disabele SSL verification here.
498
498
  # max_channels: this method use lockfiles to prevent an excesive number of API calls from each datacenter. There is not allowed more simultaneous calls than max_channels.
499
499
  # TODO: setup max_simultaneus_calls in the configurtion file.
500
- def self.call_post(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE, max_channels=10)
500
+ def self.call_post(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
501
501
  # build the lockfile name
502
- raise "Max Channels cannot be higher than #{BlackStack::Netting::MAX_CHANNELS.to_s}" if max_channels > BlackStack::Netting::MAX_CHANNELS.to_i
503
- x = rand(max_channels)
502
+ raise "Max Channels cannot be higher than #{BlackStack::Netting::MAX_CHANNELS.to_s}" if BlackStack::Commons.max_api_call_channels > BlackStack::Netting::MAX_CHANNELS.to_i
503
+ x = rand(BlackStack::Commons.max_api_call_channels)
504
504
 
505
505
  # lock the file
506
506
  LOCKFILES[x].flock(File::LOCK_EX)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstack_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi