fanforce-worker 0.31.0 → 0.32.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: b00dc815d382322dd3328c71740a910c613fa04d
4
- data.tar.gz: 6744c0ffc2932013c2659fed1d125a5dfaffccff
3
+ metadata.gz: 7c71c11441ca20666707cfda018361ddcae5108e
4
+ data.tar.gz: 9e9fd0de91fb612f9eb9dabf9227ebe0d9c033d8
5
5
  SHA512:
6
- metadata.gz: 4f1013f8b2ee5ee484d36a43017015f8893c6c5a1cb5110f61682a1c87ce0cc273cab548ec7fa698960b17dae6c0f9e649f7ef351718bde01d18c6e802f219df
7
- data.tar.gz: 6438e99930cc98fadeff9c25e924bc2cb599bfab13fac710daaa0e5cac5129dbe50352576ef556223bba21516fe51faa615374b052a46811164c17ad54f36494
6
+ metadata.gz: e6bb2bd78b13048972dc62afe18e7dfdc873080069a464f158bdfdb959cb807724510d6bd481007448812bfc497a6bbc90139f704963467394f64fe2dd3582e6
7
+ data.tar.gz: 7951521e3f433a99bebbc38d2bec824fa1f9324ae8de869cae8ea73f5c390ba1ea5807c6bd3ef5ee768547af547dbf2c68ac9632a60887df9bda14a8fcfc5d10
@@ -142,6 +142,7 @@ class Fanforce::Worker::Error
142
142
  def self.retry(queue_id, raw_error)
143
143
  error = format(raw_error.symbolize_keys)
144
144
  payload = MultiJson.load(error[:raw_json], symbolize_keys: true) rescue {}
145
+ queue_id = queue_id.gsub(":#{ENV['DEVELOPER_EMAIL']}", '') if ENV['DEVELOPER_EMAIL']
145
146
  Fanforce::Worker.set_config(iron_token: error[:iron_token], iron_project_id: error[:iron_project_id])
146
147
  Fanforce::Worker.enqueue(queue_id, payload, :retries => error[:retries] + 1)
147
148
  delete(queue_id, error[:error_id])
@@ -12,7 +12,7 @@ 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
- @queue_id = worker_data['queue_id'] || (raise 'worker_data must contain queue_id')
15
+ @queue_id = worker_data['queue_id'] || (raise 'worker_data must contain queue_id')
16
16
  @worker_env = worker_data['env_vars'] || {}
17
17
 
18
18
  @min_execution_time = min_execution_time
@@ -27,7 +27,7 @@ class Fanforce::Worker::Runner
27
27
  log.debug '------------------------------------------------------------------------------------'
28
28
  job_num = 0
29
29
  job_data = nil
30
- while job_has_enough_time_to_run and (job = Fanforce::Worker.iron_mq.queue(@queue_id).get(timeout: 3600)) do
30
+ while job_has_enough_time_to_run and (job = Fanforce::Worker.iron_mq.queue(iron_queue_id(@queue_id)).get(timeout: 3600)) do
31
31
  log.debug "- JOB #{job_num+=1}: #{job.body}"
32
32
  timeout(worker_time_remaining, Timeout) do
33
33
  job_data = nil
@@ -7,4 +7,8 @@ module Fanforce::Worker::Utils
7
7
  Fanforce::Worker.log
8
8
  end
9
9
 
10
+ def iron_queue_id(iron_queue_id)
11
+ (ENV['RACK_ENV'] == 'development' && ENV['DEVELOPER_EMAIL']) ? "#{iron_queue_id}:#{ENV['DEVELOPER_EMAIL']}" : iron_queue_id
12
+ end
13
+
10
14
  end
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class Worker
3
- VERSION = '0.31.0'
3
+ VERSION = '0.32.0'
4
4
  end
5
5
  end
@@ -38,6 +38,7 @@ class Fanforce::Worker
38
38
  def self.enqueue(queue_id, params, options={})
39
39
  raise 'Params being sent to the queue must be a Hash' if !params.is_a?(Hash)
40
40
 
41
+ queue_id = Utils.iron_queue_id(queue_id)
41
42
  retries = (options[:retries].present?) ? options.delete(:retries) : 0
42
43
  iron_mq.queue(queue_id).post({params: params, retries: retries}.to_json, options)
43
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iron_mq