fanforce-worker 0.14.4 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/fanforce/worker/version.rb +1 -1
- data/lib/fanforce/worker/worker.rb +8 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzVlYWZhZWUyOTlkNWZkMmIwNzkzMDAyMDJlMGU2MDkzZjhhNzBhNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzAwYWFkMDMzMjZjMWZmOGMzYmM2NjM5Y2Y0ZmFkN2VhMzYzNjc4Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjgwNjRjMDYxYTJlYzNiYmY0ZDBhMzY0MmQ3ODM3MWY0NjlmMTFjM2E0N2Vh
|
10
|
+
ZjFhZTZhZmVmYTFjNTQ0N2VkMjZhYTcyOWMxMDRjYTYzYzRmNTg3ZWY4YjA0
|
11
|
+
ZGJlMmY4NGRmOTBkOTBjYTQzMGMyNWEzMDRiMjU1MGViMjM3ODQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWI1NWVmNzBmYjgxZGYxMDRlMDZjZWRiODM0ZDFiMzhkNjJhYTg2YjA0NzA2
|
14
|
+
NGI4MDA2NDY0MWMzMDFmOWRmYTRjMjZlOTk5OGNlZWZkNTdmMDI1OTM5Mzg4
|
15
|
+
ZjA0YmVhOGE5YjUyNmNlNDA0NTAyYTM0NzhjMTczZDBhODlkNDE=
|
@@ -147,7 +147,7 @@ class Fanforce::Worker
|
|
147
147
|
def self.run(worker_data, min_execution_time=300, &code_block)
|
148
148
|
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
|
149
149
|
|
150
|
-
puts 'LOADING ENV...'
|
150
|
+
puts 'LOADING WORKER ENV...'
|
151
151
|
load_env
|
152
152
|
require 'iron_mq'
|
153
153
|
require 'iron_cache'
|
@@ -158,7 +158,8 @@ class Fanforce::Worker
|
|
158
158
|
self.current_worker_env = worker_data['env_vars']
|
159
159
|
queue = IronMQ::Client.new.queue(current_queue_id)
|
160
160
|
|
161
|
-
puts 'PROCESSING...'
|
161
|
+
puts 'PROCESSING JOBS...'
|
162
|
+
puts '------------------------------------------------------------------------------------'
|
162
163
|
job_num = 0
|
163
164
|
job_data = nil
|
164
165
|
while job_has_enough_time_to_run(min_execution_time) and (job = queue.get(timeout: 3600)) do
|
@@ -169,9 +170,10 @@ class Fanforce::Worker
|
|
169
170
|
run_job(job, job_data, &code_block)
|
170
171
|
end
|
171
172
|
self.delete_job
|
173
|
+
puts '------------------------------------------------------------------------------------'
|
172
174
|
end
|
173
175
|
self.delete_job
|
174
|
-
puts
|
176
|
+
puts 'WINDING DOWN WORKER!'
|
175
177
|
rescue Timeout::Error => e
|
176
178
|
handle_job_error(e, job, job_data)
|
177
179
|
rescue Exception => e
|
@@ -195,9 +197,6 @@ class Fanforce::Worker
|
|
195
197
|
end
|
196
198
|
|
197
199
|
def self.run_job(job, job_data, &code_block)
|
198
|
-
puts '----------------------------------------------------------'
|
199
|
-
puts 'PROCESSING JOB... '
|
200
|
-
|
201
200
|
self.current_job = job
|
202
201
|
self.current_params = job_data[:params]
|
203
202
|
self.current_retries = job_data[:retries]
|
@@ -214,9 +213,7 @@ class Fanforce::Worker
|
|
214
213
|
raise($!, "#{$!}: THERE IS NO JOB", $!.backtrace) if job.nil?
|
215
214
|
|
216
215
|
self.delete_job(job)
|
217
|
-
puts 'REMOVED JOB FROM QUEUE'
|
218
|
-
|
219
|
-
puts 'CANNOT SAVE TO ERROR CACHE:'
|
216
|
+
puts 'REMOVED JOB FROM QUEUE, BUT COULD NOT SAVE TO ERROR CACHE...'
|
220
217
|
raise($!, "#{$!}: #{job_data.to_json}", $!.backtrace)
|
221
218
|
end
|
222
219
|
|
@@ -234,9 +231,8 @@ class Fanforce::Worker
|
|
234
231
|
error[:curl_command] = e.curl_command if e.respond_to?(:curl_command)
|
235
232
|
|
236
233
|
self.delete_job(job)
|
237
|
-
puts 'REMOVED JOB FROM QUEUE'
|
238
|
-
|
239
|
-
puts "SAVING TO ERROR CACHE: #{error.to_json}"
|
234
|
+
puts 'REMOVED JOB FROM QUEUE, AND SAVING TO ERROR CACHE...'
|
235
|
+
puts error.to_json
|
240
236
|
self.add_error current_queue_id, error
|
241
237
|
end
|
242
238
|
|