cf_light_api 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cf_light_api/worker.rb +10 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 417316fd53dc02ae75d5173f4476810f1d859e20
4
- data.tar.gz: 2352be1e3ef38ca27cfe76ce335d8da94f242976
3
+ metadata.gz: f79c9dd7253511cebab13f81590277976b6c46b5
4
+ data.tar.gz: 0f24c83eaecddbcc14cf791551ddbf41d8e26b4f
5
5
  SHA512:
6
- metadata.gz: e140e367cfe2ca04c18fca383102e80fd26c54255da38477703157dd360ad444d58401b138bdb3150c0719b87b0cac7247fd1bd02e8cdbdaef4b645daf19809f
7
- data.tar.gz: 2e253d06021d0b874d5d150d2e76d2b775b11ec9eef3cf3d0de38aa05527f62035a12c106af07e1a1fa5a40558f61b18df7f92a6a4be02f425519a63008fb643
6
+ metadata.gz: 46f5242f6978654e8068cdd77908956ae039df031856185adaa4ec0f1ad56e3ba8ef0050703addea0d26f77a135cbdcfd8dd4debc6cfc44f86e3a1a45e126d26
7
+ data.tar.gz: cefefdacff01ac70e6bc9c15f0cdc89ca577a50be27d6ba6b7cf53d821bea7476da74502c9da55f86bf9cd359bf285604d84c32a54f0cba43cd788e6ce8865fe
@@ -16,6 +16,7 @@ scheduler.every '5m', :first_in => '5s', :overlap => false, :timeout => '15m' do
16
16
  end
17
17
 
18
18
  lock
19
+ start_time = Time.now
19
20
 
20
21
  puts "[cf_light_api:worker] Updating data..."
21
22
 
@@ -34,9 +35,7 @@ scheduler.every '5m', :first_in => '5s', :overlap => false, :timeout => '15m' do
34
35
  }
35
36
 
36
37
  org.spaces.each do |space|
37
- puts "processing space #{space.name}..."
38
38
  space.apps.each do |app|
39
- puts "processing app #{app.name}..."
40
39
  app_data << format_app_data(app, org.name, space.name)
41
40
  end
42
41
  end
@@ -47,6 +46,8 @@ scheduler.every '5m', :first_in => '5s', :overlap => false, :timeout => '15m' do
47
46
  put_in_redis "#{ENV['REDIS_KEY_PREFIX']}:orgs", org_data
48
47
  put_in_redis "#{ENV['REDIS_KEY_PREFIX']}:apps", app_data
49
48
 
49
+ puts "[cf_light_api:worker] Update completed in #{format_duration(Time.now.to_f - start_time.to_f)}..."
50
+
50
51
  rescue Rufus::Scheduler::TimeoutError
51
52
  puts '[cf_light_api:worker] Data update took too long and was aborted...'
52
53
  end
@@ -104,3 +105,10 @@ def put_in_redis(key, data)
104
105
  puts "[cf_light_api:worker] Putting data #{data} into redis key #{key}"
105
106
  REDIS.set key, data.to_json
106
107
  end
108
+
109
+ def format_duration(elapsed_seconds)
110
+ seconds = elapsed_seconds % 60
111
+ minutes = (elapsed_seconds / 60) % 60
112
+ hours = elapsed_seconds / (60 * 60)
113
+ format("%02d hrs, %02d mins, %02d secs", hours, minutes, seconds)
114
+ end
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.1.0
4
+ version: 1.1.1
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-03-05 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cfoundry