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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c017adc129ac7a434ceabc18789ffa3961e7a13
4
- data.tar.gz: 4a7f812e0810ca90604bb300a10b43f31c019116
3
+ metadata.gz: 8c0ac22cadc2b8b7c0544f2bc924e6138f48e3de
4
+ data.tar.gz: b81dc251dfd39a7c197cae41c76c0fae6bdd5912
5
5
  SHA512:
6
- metadata.gz: 0a6c69686ed7cebc1ba2531a2df856d6f9f154181b1eeb3ff82b82e5f528df3e44b7fd3a6b07d24398b8958a35f4dbb6091fe5a5a0046a23dada6d060ee19a3a
7
- data.tar.gz: 9f75a0b951dfd8b9d72c490ae40aeff1a2871e723a9e98ce81702203afe563f6592c76dd7318d41a2123b2a7219c396827f652d47860e0c879255459b47d0c82
6
+ metadata.gz: 0d4689fc521101f7e25b875a838c9182adc37d9119e5f0cd1b48f672b26f35a316ed610cad5864a80e2f6d548421a7d68e9e907b770c73aff96d33b540a4ff54
7
+ data.tar.gz: 0b8cdd8803a6c3f4b92e3a723488d25d2c1fbf226770b99ee63535d87795fc82e66b01f1c56d093c6b76dad8a342b1877f00c50f557346d1fc2c1defc82850e8
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,8 @@
1
1
  = Simple Job
2
2
 
3
+ == Version 0.12.1
4
+ * Ignoring messages that don't look like valid job definitions
5
+
3
6
  == Version 0.12.0
4
7
  * Added accept_nested_definition option to SQSJobQueue
5
8
  * Updating specs and eliminating their dependency on AWS
@@ -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
- raise('no definition found') if !definition_class
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
- if definition_class.max_attempt_count && (message.receive_count > definition_class.max_attempt_count)
184
- raise('max attempt count reached')
185
- end
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
- definition = definition_class.new.from_json(message_body)
188
- last_definition = definition
189
+ definition = definition_class.new.from_json(message_body)
190
+ last_definition = definition
189
191
 
190
- # NOTE: only executes if asynchronous_execute is false (message will be re-enqueued after
191
- # vis. timeout if this fails or runs too long)
192
- message_handler.call(definition, message) unless asynchronous_execute
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
@@ -1,3 +1,3 @@
1
1
  module SimpleJob
2
- VERSION = '0.12.0'
2
+ VERSION = '0.12.1'
3
3
  end
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.0
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.4.5
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.