cloudtasker 0.12.rc5 → 0.12.rc6

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
  SHA256:
3
- metadata.gz: a1f63a9bfefe90d0cfa0d6b567098ec72efe150894fbd878daa72fe934d27a25
4
- data.tar.gz: 347d6358120bd83f116b569fafcd0313a96d8c34a4f6222ca20b0dedda866098
3
+ metadata.gz: 00be8d2e572e3129ef5330cdbb555aa0485edd15b191d5d8ccc5d28a98a0eab8
4
+ data.tar.gz: 79067d7953556f03e9a81ee9d977cf2734a9843df8f9a4613dbd8d81274bc599
5
5
  SHA512:
6
- metadata.gz: a4ecf9ad17d612133653f70e7691fc746742c3ca62eb8f67c09bdc1992776391e755a5c674b97d0339bd74514958299062610d448b089fe5995dd6abe5756021
7
- data.tar.gz: 231f0ba89cf89db4bdb138a1d34d10688161d156c9898da7a067783f75f930b9318a08dfdf240188e23dfa3a0e9dd59b38b1b235b5ab5038eb6727a244877017
6
+ metadata.gz: 99d9b7ba99390e6bc10e9ed917262782a7c47814df6412c847dedd06a8a06a6b9ad4eaf5ddbcde03534ec88f34fcb1cda03621a3c2a0202031d087e6cd915c5f
7
+ data.tar.gz: e15a6a167f15dbd8c390c7d393a80297b6cd805c85d4e5ca16f961ff147c909bebbfcf9c326708e7d7508caa3ff47b726f071e618e3979a1340848420311ddbb
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Changelog
2
2
 
3
- ## Latest RC [v0.12.rc5](https://github.com/keypup-io/cloudtasker/tree/v0.12.rc5) (2021-03-30)
3
+ ## Latest RC [v0.12.rc6](https://github.com/keypup-io/cloudtasker/tree/v0.12.rc6) (2021-03-31)
4
4
 
5
- [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.12.rc5)
5
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.12.rc6)
6
6
 
7
7
  **Improvements:**
8
8
  - ActiveJob: do not double log errors (ActiveJob has its own error logging)
@@ -11,6 +11,7 @@
11
11
  - Batch callbacks: Retry jobs when completion callback fails
12
12
  - Redis: Use Redis Sets instead of key pattern matching for listing methods (Cron jobs and Local Server)
13
13
  - Batch progress: restrict calculation to direct children by default. Allow depth to be specified. Calculating progress using all tree jobs created significant delays on large batches.
14
+ - Worker: raise DeadWorkerError instead of MissingWorkerArgumentsError when arguments are missing. This is more consistent with what middlewares expect.
14
15
 
15
16
  **Fixed bugs:**
16
17
  - Retries: Enforce job retry limit on job processing. There was an edge case where jobs could be retried indefinitely on batch callback errors.
@@ -19,7 +19,7 @@ module Cloudtasker
19
19
  # Process payload
20
20
  WorkerHandler.execute_from_payload!(payload)
21
21
  head :no_content
22
- rescue DeadWorkerError, MissingWorkerArgumentsError
22
+ rescue DeadWorkerError
23
23
  # 205: job will NOT be retried
24
24
  head :reset_content
25
25
  rescue InvalidWorkerError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cloudtasker
4
- VERSION = '0.12.rc5'
4
+ VERSION = '0.12.rc6'
5
5
  end
@@ -332,6 +332,22 @@ module Cloudtasker
332
332
  job_retries > job_max_retries
333
333
  end
334
334
 
335
+ #
336
+ # Return true if the job arguments are missing.
337
+ #
338
+ # This may happen if a job
339
+ # was successfully run but retried due to Cloud Task dispatch deadline
340
+ # exceeded. If the arguments were stored in Redis then they may have
341
+ # been flushed already after the successful completion.
342
+ #
343
+ # If job arguments are missing then the job will simply be declared dead.
344
+ #
345
+ # @return [Boolean] True if the arguments are missing.
346
+ #
347
+ def arguments_missing?
348
+ job_args.empty? && [0, -1].exclude?(method(:perform).arity)
349
+ end
350
+
335
351
  #
336
352
  # Return the time taken (in seconds) to perform the job. This duration
337
353
  # includes the middlewares and the actual perform method.
@@ -384,14 +400,9 @@ module Cloudtasker
384
400
  Cloudtasker.config.server_middleware.invoke(self) do
385
401
  # Immediately abort the job if it is already dead
386
402
  flag_as_dead if job_dead?
403
+ flag_as_dead(MissingWorkerArgumentsError.new('worker arguments are missing')) if arguments_missing?
387
404
 
388
405
  begin
389
- # Abort if arguments are missing. This may happen with redis arguments storage
390
- # if Cloud Tasks times out on a job but the job still succeeds
391
- if job_args.empty? && [0, -1].exclude?(method(:perform).arity)
392
- raise(MissingWorkerArgumentsError, 'worker arguments are missing')
393
- end
394
-
395
406
  # Perform the job
396
407
  perform(*job_args)
397
408
  rescue StandardError => e
@@ -107,7 +107,7 @@ module Cloudtasker
107
107
  redis.expire(args_payload_key, ARGS_PAYLOAD_CLEANUP_TTL) if args_payload_key && !worker.job_reenqueued
108
108
 
109
109
  resp
110
- rescue DeadWorkerError, MissingWorkerArgumentsError => e
110
+ rescue DeadWorkerError => e
111
111
  # Delete stored args payload if job is dead
112
112
  redis.expire(args_payload_key, ARGS_PAYLOAD_CLEANUP_TTL) if args_payload_key
113
113
  log_execution_error(worker, e)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudtasker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.rc5
4
+ version: 0.12.rc6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Lachaume
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2021-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport