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 +4 -4
- data/lib/fanforce/worker/runner.rb +2 -4
- data/lib/fanforce/worker/version.rb +1 -1
- data/lib/fanforce/worker/worker.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95cc74ba08883ad861e7f022b6d26f8aedf2e85f
|
4
|
+
data.tar.gz: 0c17f08e675858e7be3241887b099350db9674dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 -
|
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 -
|
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
|