blackstack_commons 1.1.14 → 1.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/functions.rb +9 -12
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6c6a1715a79bae9f7695f9870b0767dd4a0debd
4
- data.tar.gz: fbf471ae84176dcd76df2dd9e4a344acb422ca77
3
+ metadata.gz: c1a7386829f86723990a77eb63de963ed945a647
4
+ data.tar.gz: f7a944473b31efb6b86cfc57ce74c1bb59d45f17
5
5
  SHA512:
6
- metadata.gz: 0636e596a18c71af2619ca03b7d7b5c9db74db47cc88c4ae8ec20399d5c249962ab053a722fcfc67f63d62c8d1ac63242504dadbe06e0741c778cd7df14747f8
7
- data.tar.gz: d6230f34adc16b720e70a2ba5047ae697fdbfe50d8556a433cb89cbd6987feab70aec6ef41d4dd47172b1679d862817134de6e9ab5ab217623bf4eab954bcbfe
6
+ metadata.gz: 63bff98f98bfa0b28d0939aafe376d77830e191041e1a85b5e69342fa3841e471f711b34335a28f1fda9708a313f865363e7808222033138af3b2e9149e8dc7b
7
+ data.tar.gz: 6a14b5ec1846858bfa9c3d0fcbd3872d5a19c267d0e6e8d3e6a0ff850950fde249070a0d8e1e1c9ff97c75ba6cfb8ed7ff0d0f14804e5faa781a0e8b5c738aba
data/lib/functions.rb CHANGED
@@ -506,15 +506,12 @@ module BlackStack
506
506
  # ssl_verify_mode: you can disabele SSL verification here.
507
507
  # 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.
508
508
  # TODO: setup max_simultaneus_calls in the configurtion file.
509
- def self.call_post(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
509
+ def self.call_post(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE, use_lockfile=true)
510
510
  # build the lockfile name
511
- raise "Max Channels cannot be higher than #{BlackStack::Netting.lockfiles.size.to_s}" if BlackStack::Netting.max_api_call_channels > BlackStack::Netting.lockfiles.size
512
- #puts ''
513
- #puts "BlackStack::Netting.max_api_call_channels:#{BlackStack::Netting.max_api_call_channels.to_s}."
514
- x = rand(BlackStack::Netting.max_api_call_channels)
515
- #puts "x:#{x.to_s}."
516
- # lock the file
517
- BlackStack::Netting.lockfiles[x].flock(File::LOCK_EX)
511
+ # raise "Max Channels cannot be higher than #{BlackStack::Netting.lockfiles.size.to_s}" if BlackStack::Netting.max_api_call_channels > BlackStack::Netting.lockfiles.size
512
+ # x = rand(BlackStack::Netting.max_api_call_channels)
513
+ # # lock the file
514
+ # BlackStack::Netting.lockfiles[x].flock(File::LOCK_EX) if use_lockfile
518
515
 
519
516
  begin
520
517
 
@@ -528,23 +525,23 @@ module BlackStack
528
525
  res = http.request req
529
526
  case res
530
527
  when Net::HTTPSuccess then res
531
- when Net::HTTPRedirection then BlackStack::Netting::call_post(URI(res['location']), params)
528
+ when Net::HTTPRedirection then BlackStack::Netting::call_post(URI(res['location']), params, BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE, false)
532
529
  else
533
530
  res.error!
534
531
  end
535
532
  end
536
533
 
537
534
  # release the file
538
- BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN)
535
+ # BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile
539
536
  rescue => e
540
537
  # release the file
541
- BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN)
538
+ # BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile
542
539
 
543
540
  # elevo la excepcion
544
541
  raise e
545
542
  ensure
546
543
  # release the file
547
- BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN)
544
+ # BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile
548
545
  end
549
546
 
550
547
  # return
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.14
4
+ version: 1.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi