rorvswild 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rorvswild/client.rb +31 -3
- data/lib/rorvswild/version.rb +1 -1
- data/rorvswild.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8e0e177bc8b3c9645a79f0b4d39fcf27ed804f
|
4
|
+
data.tar.gz: 31e58a5359e4b691d80d23c23dddfaedb9a3fc76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39a57beba2498edf1ea8e1790a45991f434cfe89e925717a55c0353500d1d62a4068149510ebb24e197d82c9fa10ae9252bedea1316a0ad17694244688501382
|
7
|
+
data.tar.gz: bd19b326fb647010c5fba1db667804c50742b12c97ff97d58509a99b7922aed9e80ce170a78165cee50e0a9cc96a8eab45b0d046a0a03e6c964bf904d8739a50
|
data/README.md
CHANGED
data/lib/rorvswild/client.rb
CHANGED
@@ -17,6 +17,9 @@ module RorVsWild
|
|
17
17
|
@api_key = config[:api_key]
|
18
18
|
@timeout ||= config[:timeout] || DEFAULT_TIMEOUT
|
19
19
|
@threads = Set.new
|
20
|
+
@connections = []
|
21
|
+
@connection_count = 0
|
22
|
+
@mutex = Mutex.new
|
20
23
|
end
|
21
24
|
|
22
25
|
def post(path, data)
|
@@ -25,11 +28,36 @@ module RorVsWild
|
|
25
28
|
post.content_type = "application/json".freeze
|
26
29
|
post.basic_auth(nil, api_key)
|
27
30
|
post.body = data.to_json
|
28
|
-
|
31
|
+
transmit(post)
|
29
32
|
end
|
30
33
|
|
31
|
-
def
|
32
|
-
@
|
34
|
+
def take_connection
|
35
|
+
@mutex.synchronize { @connections.shift }
|
36
|
+
end
|
37
|
+
|
38
|
+
def release_connection(http)
|
39
|
+
@mutex.synchronize { @connections.push(http) } if http
|
40
|
+
end
|
41
|
+
|
42
|
+
def max_connections
|
43
|
+
@max_connections ||= [Process.getrlimit(Process::RLIMIT_NOFILE).first / 10, 10].max
|
44
|
+
end
|
45
|
+
|
46
|
+
def take_or_create_connection
|
47
|
+
if http = take_connection
|
48
|
+
http
|
49
|
+
elsif @connection_count < max_connections
|
50
|
+
@connection_count += 1
|
51
|
+
new_http
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def transmit(request)
|
56
|
+
if http = take_or_create_connection
|
57
|
+
http.request(request)
|
58
|
+
end
|
59
|
+
ensure
|
60
|
+
release_connection(http)
|
33
61
|
end
|
34
62
|
|
35
63
|
def new_http
|
data/lib/rorvswild/version.rb
CHANGED
data/rorvswild.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Alexis Bernard"]
|
10
10
|
spec.email = ["alexis@bernard.io"]
|
11
11
|
spec.summary = "Ruby on Rails app monitoring"
|
12
|
-
spec.description = "Performances
|
12
|
+
spec.description = "Performances and quality insights for rails developers."
|
13
13
|
spec.homepage = "https://www.rorvswild.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rorvswild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Performances
|
13
|
+
description: Performances and quality insights for rails developers.
|
14
14
|
email:
|
15
15
|
- alexis@bernard.io
|
16
16
|
executables:
|