cf_light_api 1.3.2 → 1.3.3
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/cf_light_api/worker.rb +8 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a80db08fc9bd5d69b56d8ae001a2cd4175e786a8
|
4
|
+
data.tar.gz: 0eadeabd636e69c5f00a2314a7ed8820133d9786
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723a44543f74b70a62073a381f3f76abe9389df01e48a284dc9c97eb09fd5c317df7f9ab09d88bb0e668343e40dce0f086d8a8ca52a48dc7566293cdb360f59a
|
7
|
+
data.tar.gz: d122b78848b14f649860f1273164c9d613e791b90a53e14bab56e56bb0d06e65a35d8770e44e0b129fdf3d2305a6f3185a7927b7c131c383e67c00762a2e3783
|
data/lib/cf_light_api/worker.rb
CHANGED
@@ -15,15 +15,18 @@ end
|
|
15
15
|
next
|
16
16
|
end
|
17
17
|
|
18
|
+
PARALLEL_MAPS = ENV['PARALLEL_MAPS'].to_i || 4
|
19
|
+
|
18
20
|
lock_manager = Redlock::Client.new([ENV['REDIS_URI']])
|
19
21
|
scheduler = Rufus::Scheduler.new
|
20
22
|
scheduler.every '5m', :first_in => '5s', :overlap => false, :timeout => '5m' do
|
23
|
+
cf_client = nil
|
21
24
|
begin
|
22
25
|
lock_manager.lock("#{ENV['REDIS_KEY_PREFIX']}:lock", 5*60*1000) do |lock|
|
23
26
|
if lock
|
24
27
|
start_time = Time.now
|
25
28
|
|
26
|
-
@logger.info "Updating data..."
|
29
|
+
@logger.info "Updating data in parallel (#{PARALLEL_MAPS})..."
|
27
30
|
|
28
31
|
cf_client = get_client()
|
29
32
|
|
@@ -53,12 +56,12 @@ def get_client(cf_api=ENV['CF_API'], cf_user=ENV['CF_USER'], cf_password=ENV['CF
|
|
53
56
|
end
|
54
57
|
|
55
58
|
def get_app_data(cf_client)
|
56
|
-
Parallel.map(cf_client.organizations, :in_processes =>
|
59
|
+
Parallel.map(cf_client.organizations, :in_processes => PARALLEL_MAPS) do |org|
|
57
60
|
org_name = org.name
|
58
|
-
Parallel.map(org.spaces, :in_processes =>
|
61
|
+
Parallel.map(org.spaces, :in_processes => PARALLEL_MAPS) do |space|
|
59
62
|
space_name = space.name
|
60
63
|
@logger.info "Getting app data for apps in #{org_name}:#{space_name}..."
|
61
|
-
Parallel.map(space.apps, :in_processes =>
|
64
|
+
Parallel.map(space.apps, :in_processes => PARALLEL_MAPS) do |app|
|
62
65
|
begin
|
63
66
|
# It's possible for an app to have been terminated before this stage is reached.
|
64
67
|
format_app_data(app, org_name, space_name)
|
@@ -71,7 +74,7 @@ def get_app_data(cf_client)
|
|
71
74
|
end
|
72
75
|
|
73
76
|
def get_org_data(cf_client)
|
74
|
-
Parallel.map( cf_client.organizations, :in_processes =>
|
77
|
+
Parallel.map( cf_client.organizations, :in_processes => PARALLEL_MAPS) do |org|
|
75
78
|
org_name = org.name
|
76
79
|
@logger.info "Getting org data for #{org_name}..."
|
77
80
|
# The CFoundry client returns memory_limit in MB, so we need to normalise to Bytes to match the Apps.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf_light_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Springer Platform Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfoundry
|
@@ -102,9 +102,9 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ./lib/sinatra/cf_light_api.rb
|
105
106
|
- ./lib/cf_light_api/redis.rb
|
106
107
|
- ./lib/cf_light_api/worker.rb
|
107
|
-
- ./lib/sinatra/cf_light_api.rb
|
108
108
|
- bin/cf_light_api
|
109
109
|
homepage: https://github.com/springerpe/cf-light-api
|
110
110
|
licenses:
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.0.14
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: A super lightweight API for reading App and Org data from CloudFoundry, cached
|