simple_job 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +3 -0
- data/lib/simple_job/sqs_job_queue.rb +19 -14
- data/lib/simple_job/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0ac22cadc2b8b7c0544f2bc924e6138f48e3de
|
4
|
+
data.tar.gz: b81dc251dfd39a7c197cae41c76c0fae6bdd5912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4689fc521101f7e25b875a838c9182adc37d9119e5f0cd1b48f672b26f35a316ed610cad5864a80e2f6d548421a7d68e9e907b770c73aff96d33b540a4ff54
|
7
|
+
data.tar.gz: 0b8cdd8803a6c3f4b92e3a723488d25d2c1fbf226770b99ee63535d87795fc82e66b01f1c56d093c6b76dad8a342b1877f00c50f557346d1fc2c1defc82850e8
|
data/CHANGELOG.rdoc
CHANGED
@@ -172,24 +172,29 @@ class SQSJobQueue < JobQueue
|
|
172
172
|
begin
|
173
173
|
sqs_queue.receive_messages(options) do |message|
|
174
174
|
message_body = get_message_body(message)
|
175
|
-
last_message = message
|
176
|
-
last_message_at = Time.now
|
177
175
|
raw_message = JSON.parse(message_body)
|
178
|
-
current_job_type = raw_message['type']
|
179
|
-
definition_class = JobDefinition.job_definition_class_for(raw_message['type'], raw_message['version'])
|
180
176
|
|
181
|
-
|
177
|
+
if raw_message['type'] && raw_message['version']
|
178
|
+
last_message = message
|
179
|
+
last_message_at = Time.now
|
180
|
+
current_job_type = raw_message['type']
|
181
|
+
definition_class = JobDefinition.job_definition_class_for(raw_message['type'], raw_message['version'])
|
182
182
|
|
183
|
-
|
184
|
-
|
185
|
-
|
183
|
+
raise('no definition found') if !definition_class
|
184
|
+
|
185
|
+
if definition_class.max_attempt_count && (message.receive_count > definition_class.max_attempt_count)
|
186
|
+
raise('max attempt count reached')
|
187
|
+
end
|
186
188
|
|
187
|
-
|
188
|
-
|
189
|
+
definition = definition_class.new.from_json(message_body)
|
190
|
+
last_definition = definition
|
189
191
|
|
190
|
-
|
191
|
-
|
192
|
-
|
192
|
+
# NOTE: only executes if asynchronous_execute is false (message will be re-enqueued after
|
193
|
+
# vis. timeout if this fails or runs too long)
|
194
|
+
message_handler.call(definition, message) unless asynchronous_execute
|
195
|
+
else
|
196
|
+
logger.info("ignoring invalid message: #{message_body}")
|
197
|
+
end
|
193
198
|
end
|
194
199
|
|
195
200
|
# NOTE: only executes if asynchronous_execute is set (after message has been confirmed)
|
@@ -378,7 +383,7 @@ class SQSJobQueue < JobQueue
|
|
378
383
|
result = message_hash[accept_nested_definition]
|
379
384
|
end
|
380
385
|
|
381
|
-
result
|
386
|
+
result || '{}'
|
382
387
|
end
|
383
388
|
|
384
389
|
end
|
data/lib/simple_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Dawson
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.2.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Support classes and modules for executable jobs.
|