fanforce-worker 0.17.2 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66341ba45b8ae61e0b063c81f6b24d5eea57815a
4
- data.tar.gz: b7cf55420ab52c21b4de5d3683e06a6a49e3d6c0
3
+ metadata.gz: 95cc74ba08883ad861e7f022b6d26f8aedf2e85f
4
+ data.tar.gz: 0c17f08e675858e7be3241887b099350db9674dd
5
5
  SHA512:
6
- metadata.gz: d6f32aaf24c3be0ef07bc54afe2080f1422fb2067c84234c1e56a06ede25383862e21dc845007600688b027b23c0200f6ba313f454b7874906b8ff6d1afefe2f
7
- data.tar.gz: f29d00541152d99f0d8ea81c541e9b8fd2e00ef36df2bec1c4cb425dbf3ca88337cee0dc69132e99ff359967bf7a68a81fafde8eb8cc3a27d0fe5baec0eca863
6
+ metadata.gz: 3075eae0cb2b03b26ec53d2cfa56556102a88ab32b2420065c15179037e24d2e14be7c2a2e4b04f7620958451a984d099f809f152ed49781089a6c6494fd4f2c
7
+ data.tar.gz: 92bcfe8b4a4aac7ed67279e08f70b3c4c28c5dd579f39dbee927a58fe420c0d3a4917d7a64209949f5a94d60467f1110659ae53fe2367f4454e70614e9bbe9ed
@@ -12,8 +12,6 @@ class Fanforce::Worker::Runner
12
12
  raise "min_execution_time was set to #{min_execution_time}, which is #{min_execution_time - MAX_EXECUTION_TIME} seconds too long" if min_execution_time > MAX_EXECUTION_TIME
13
13
  log.debug 'LOADING WORKER ENV'
14
14
 
15
- @worker_started_at = Time.now
16
-
17
15
  @queue_id = worker_data['queue_id'] || (raise 'worker_data must contain queue_id')
18
16
  @worker_env = worker_data['env_vars'] || {}
19
17
 
@@ -87,12 +85,12 @@ class Fanforce::Worker::Runner
87
85
  end
88
86
 
89
87
  def worker_time_remaining
90
- time_since_load = Time.now - @worker_started_at
88
+ time_since_load = Time.now - Fanforce::Worker::LOADED_AT
91
89
  MAX_EXECUTION_TIME - time_since_load
92
90
  end
93
91
 
94
92
  def job_has_enough_time_to_run
95
- time_since_load = Time.now - @worker_started_at
93
+ time_since_load = Time.now - Fanforce::Worker::LOADED_AT
96
94
  return false if time_since_load > MAX_EXECUTION_TIME
97
95
  return false if worker_time_remaining < @min_execution_time
98
96
  return true
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class Worker
3
- VERSION = '0.17.2'
3
+ VERSION = '0.18.0'
4
4
  end
5
5
  end
@@ -1,5 +1,7 @@
1
1
  class Fanforce::Worker
2
2
 
3
+ LOADED_AT = Time.now
4
+
3
5
  @@iron = {}
4
6
  @@redis = {}
5
7
  @@log = Logger.new($stdout)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark