blackstack_commons 1.1.16 → 1.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/functions.rb +12 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e0549d0acf4be3d4d04d8b7490865a6086232dc
|
4
|
+
data.tar.gz: 6c8dcb58673b9118eacee8e8e4a28144edeac2e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daff65cd9fc59b0d0a79c1c756dd47726a0720412d8d592ff7e6d6f72b15e0d38eb0b59ed4e32724a9e6cf0091cebd2ee842ba0666685c8873a99162cdd45a3c
|
7
|
+
data.tar.gz: 29cf4d59c7768fc2c7970a1dcbd77ce059909a4b516c956e2e8a84db34448e85e0ab9d04f3bc3b3aafec5556ee4684734f3683dc4d41bc0c46e64e4cacc577ad
|
data/lib/functions.rb
CHANGED
@@ -449,7 +449,7 @@ module BlackStack
|
|
449
449
|
|
450
450
|
@@lockfiles = []
|
451
451
|
|
452
|
-
@@max_api_call_channels =
|
452
|
+
@@max_api_call_channels = 0 # 0 means infinite
|
453
453
|
|
454
454
|
def self.max_api_call_channels()
|
455
455
|
@@max_api_call_channels
|
@@ -508,11 +508,14 @@ module BlackStack
|
|
508
508
|
# TODO: setup max_simultaneus_calls in the configurtion file.
|
509
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
|
-
|
512
|
-
|
513
|
-
#
|
514
|
-
|
515
|
-
|
511
|
+
x = 0
|
512
|
+
if BlackStack::Netting.max_api_call_channels.to_i > 0
|
513
|
+
raise "Max Channels cannot be higher than #{BlackStack::Netting.lockfiles.size.to_s}" if BlackStack::Netting.max_api_call_channels > BlackStack::Netting.lockfiles.size
|
514
|
+
x = rand(BlackStack::Netting.max_api_call_channels)
|
515
|
+
# lock the file
|
516
|
+
BlackStack::Netting.lockfiles[x].flock(File::LOCK_EX) if use_lockfile
|
517
|
+
end
|
518
|
+
|
516
519
|
begin
|
517
520
|
|
518
521
|
# do the call
|
@@ -532,16 +535,16 @@ module BlackStack
|
|
532
535
|
end
|
533
536
|
|
534
537
|
# release the file
|
535
|
-
|
538
|
+
BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
536
539
|
rescue => e
|
537
540
|
# release the file
|
538
|
-
|
541
|
+
BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
539
542
|
|
540
543
|
# elevo la excepcion
|
541
544
|
raise e
|
542
545
|
ensure
|
543
546
|
# release the file
|
544
|
-
|
547
|
+
BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
545
548
|
end
|
546
549
|
|
547
550
|
# return
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackstack_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: content_spinning
|