fanforce-worker 0.35.0 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b9b32f5062c0b82d44841919dc62479f20f3c60
4
+ data.tar.gz: 61303a46648b8c7aacc7cb87f14c70eef6e663e0
5
+ SHA512:
6
+ metadata.gz: 03d68fde6b54d8dca125e1935164ab30ecb47bd510489daca4c84f6c08418f4b82410c470aaadb29d891b2c338dacb43f3e1f8da3ad76326eb8e11e671b444d2
7
+ data.tar.gz: 9910d5478787358e79688254e7841a48c0ad6d6ce985b376c450e4823eb5abda2c3558f16d4747d568a013158a4c5d34a6168661d7de06a9008ee126fd54ac98
@@ -10,6 +10,7 @@ class Fanforce::Worker::Runner
10
10
 
11
11
  def initialize(worker_data, min_execution_time=300, &code_block)
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
+ log.debug '------------------------------------------------------------------------------------'
13
14
  log.debug 'LOADING WORKER ENV'
14
15
 
15
16
  @queue_id = worker_data['queue_id'] || (raise 'worker_data must contain queue_id')
@@ -18,11 +19,15 @@ class Fanforce::Worker::Runner
18
19
  @min_execution_time = min_execution_time
19
20
  @code_block = code_block
20
21
 
21
- load_env
22
+ load_env_from_server
23
+ load_env_from_worker(@worker_env)
24
+ ENV.each {|k,v| log.debug "#{k} = #{v}" }
25
+
22
26
  load_jobs
23
27
  end
24
28
 
25
29
  def load_jobs
30
+ log.debug '------------------------------------------------------------------------------------'
26
31
  log.debug 'PROCESSING JOBS...'
27
32
  log.debug '------------------------------------------------------------------------------------'
28
33
  job_num = 0
@@ -44,7 +49,7 @@ class Fanforce::Worker::Runner
44
49
  handle_job_loading_error(e, job, job_data)
45
50
  end
46
51
 
47
- def load_env
52
+ def load_env_from_server
48
53
  if File.exists?('.developmentenv.rb')
49
54
  require '.developmentenv'
50
55
  elsif File.exists?('.stagingenv.rb')
@@ -54,12 +59,15 @@ class Fanforce::Worker::Runner
54
59
  end
55
60
  end
56
61
 
62
+ def load_env_from_worker(vars)
63
+ vars.each {|k,v| ENV[k.to_s]=v }
64
+ end
65
+
57
66
  def run_job(job, job_data, &code_block)
58
67
  @current_job = job
59
68
  @current_params = job_data[:params]
60
69
  @current_retries = job_data[:retries]
61
70
 
62
- set_env_vars(@worker_env)
63
71
  code_block.call(job_data[:params].clone, retries: job_data[:retries], queue_id: @queue_id)
64
72
  delete_job(job)
65
73
 
@@ -96,10 +104,6 @@ class Fanforce::Worker::Runner
96
104
  return true
97
105
  end
98
106
 
99
- def set_env_vars(vars)
100
- vars.each {|k,v| ENV[k.to_s]=v }
101
- end
102
-
103
107
  def delete_job(job=nil)
104
108
  return if job.nil? and @current_job.nil?
105
109
  (job || @current_job).delete
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class Worker
3
- VERSION = '0.35.0'
3
+ VERSION = '0.36.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.0
5
- prerelease:
4
+ version: 0.36.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Caleb Clark
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-10-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: iron_mq
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: iron_cache
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: uuidtools
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: activesupport
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: redis
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: fanforce-api
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -130,33 +117,26 @@ files:
130
117
  - test/test_helper.rb
131
118
  homepage: http://github.com/fanforce/fanforce-worker
132
119
  licenses: []
120
+ metadata: {}
133
121
  post_install_message:
134
122
  rdoc_options: []
135
123
  require_paths:
136
124
  - lib
137
125
  required_ruby_version: !ruby/object:Gem::Requirement
138
- none: false
139
126
  requirements:
140
- - - ! '>='
127
+ - - '>='
141
128
  - !ruby/object:Gem::Version
142
129
  version: '0'
143
- segments:
144
- - 0
145
- hash: 4268920817357779602
146
130
  required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
131
  requirements:
149
- - - ! '>='
132
+ - - '>='
150
133
  - !ruby/object:Gem::Version
151
134
  version: '0'
152
- segments:
153
- - 0
154
- hash: 4268920817357779602
155
135
  requirements: []
156
136
  rubyforge_project:
157
- rubygems_version: 1.8.23
137
+ rubygems_version: 2.0.14
158
138
  signing_key:
159
- specification_version: 3
139
+ specification_version: 4
160
140
  summary: Fanforce worker used by various Fanforce apps for background processing.
161
141
  test_files:
162
142
  - test/controllers/enqueue_test.rb