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.
- checksums.yaml +4 -4
- data/lib/functions.rb +9 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1a7386829f86723990a77eb63de963ed945a647
|
4
|
+
data.tar.gz: f7a944473b31efb6b86cfc57ce74c1bb59d45f17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
#
|
513
|
-
#
|
514
|
-
|
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
|