cloudtasker-tonix 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/lint_rubocop.yml +15 -0
  3. data/.github/workflows/test_ruby_3.x.yml +40 -0
  4. data/.gitignore +23 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +96 -0
  7. data/Appraisals +76 -0
  8. data/CHANGELOG.md +248 -0
  9. data/CODE_OF_CONDUCT.md +74 -0
  10. data/Gemfile +18 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +1311 -0
  13. data/Rakefile +8 -0
  14. data/_config.yml +1 -0
  15. data/app/controllers/cloudtasker/worker_controller.rb +107 -0
  16. data/bin/console +15 -0
  17. data/bin/setup +8 -0
  18. data/cloudtasker.gemspec +42 -0
  19. data/config/routes.rb +5 -0
  20. data/docs/BATCH_JOBS.md +144 -0
  21. data/docs/CRON_JOBS.md +129 -0
  22. data/docs/STORABLE_JOBS.md +68 -0
  23. data/docs/UNIQUE_JOBS.md +190 -0
  24. data/exe/cloudtasker +30 -0
  25. data/gemfiles/.bundle/config +2 -0
  26. data/gemfiles/google_cloud_tasks_1.0.gemfile +17 -0
  27. data/gemfiles/google_cloud_tasks_1.1.gemfile +17 -0
  28. data/gemfiles/google_cloud_tasks_1.2.gemfile +17 -0
  29. data/gemfiles/google_cloud_tasks_1.3.gemfile +17 -0
  30. data/gemfiles/google_cloud_tasks_1.4.gemfile +17 -0
  31. data/gemfiles/google_cloud_tasks_1.5.gemfile +17 -0
  32. data/gemfiles/google_cloud_tasks_2.0.gemfile +17 -0
  33. data/gemfiles/google_cloud_tasks_2.1.gemfile +17 -0
  34. data/gemfiles/rails_6.1.gemfile +20 -0
  35. data/gemfiles/rails_7.0.gemfile +18 -0
  36. data/gemfiles/rails_7.1.gemfile +18 -0
  37. data/gemfiles/rails_8.0.gemfile +18 -0
  38. data/gemfiles/rails_8.1.gemfile +18 -0
  39. data/gemfiles/semantic_logger_3.4.gemfile +16 -0
  40. data/gemfiles/semantic_logger_4.6.gemfile +16 -0
  41. data/gemfiles/semantic_logger_4.7.0.gemfile +16 -0
  42. data/gemfiles/semantic_logger_4.7.2.gemfile +16 -0
  43. data/lib/active_job/queue_adapters/cloudtasker_adapter.rb +89 -0
  44. data/lib/cloudtasker/authentication_error.rb +6 -0
  45. data/lib/cloudtasker/authenticator.rb +90 -0
  46. data/lib/cloudtasker/backend/google_cloud_task_v1.rb +228 -0
  47. data/lib/cloudtasker/backend/google_cloud_task_v2.rb +231 -0
  48. data/lib/cloudtasker/backend/memory_task.rb +202 -0
  49. data/lib/cloudtasker/backend/redis_task.rb +291 -0
  50. data/lib/cloudtasker/batch/batch_progress.rb +142 -0
  51. data/lib/cloudtasker/batch/extension/worker.rb +13 -0
  52. data/lib/cloudtasker/batch/job.rb +558 -0
  53. data/lib/cloudtasker/batch/middleware/server.rb +14 -0
  54. data/lib/cloudtasker/batch/middleware.rb +25 -0
  55. data/lib/cloudtasker/batch.rb +5 -0
  56. data/lib/cloudtasker/cli.rb +194 -0
  57. data/lib/cloudtasker/cloud_task.rb +130 -0
  58. data/lib/cloudtasker/config.rb +319 -0
  59. data/lib/cloudtasker/cron/job.rb +205 -0
  60. data/lib/cloudtasker/cron/middleware/server.rb +14 -0
  61. data/lib/cloudtasker/cron/middleware.rb +20 -0
  62. data/lib/cloudtasker/cron/schedule.rb +308 -0
  63. data/lib/cloudtasker/cron.rb +5 -0
  64. data/lib/cloudtasker/dead_worker_error.rb +6 -0
  65. data/lib/cloudtasker/engine.rb +24 -0
  66. data/lib/cloudtasker/invalid_worker_error.rb +6 -0
  67. data/lib/cloudtasker/local_server.rb +99 -0
  68. data/lib/cloudtasker/max_task_size_exceeded_error.rb +14 -0
  69. data/lib/cloudtasker/meta_store.rb +86 -0
  70. data/lib/cloudtasker/middleware/chain.rb +250 -0
  71. data/lib/cloudtasker/missing_worker_arguments_error.rb +6 -0
  72. data/lib/cloudtasker/redis_client.rb +166 -0
  73. data/lib/cloudtasker/retry_worker_error.rb +6 -0
  74. data/lib/cloudtasker/storable/worker.rb +78 -0
  75. data/lib/cloudtasker/storable.rb +3 -0
  76. data/lib/cloudtasker/testing.rb +184 -0
  77. data/lib/cloudtasker/unique_job/conflict_strategy/base_strategy.rb +39 -0
  78. data/lib/cloudtasker/unique_job/conflict_strategy/raise.rb +28 -0
  79. data/lib/cloudtasker/unique_job/conflict_strategy/reject.rb +11 -0
  80. data/lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb +30 -0
  81. data/lib/cloudtasker/unique_job/job.rb +168 -0
  82. data/lib/cloudtasker/unique_job/lock/base_lock.rb +70 -0
  83. data/lib/cloudtasker/unique_job/lock/no_op.rb +11 -0
  84. data/lib/cloudtasker/unique_job/lock/until_completed.rb +40 -0
  85. data/lib/cloudtasker/unique_job/lock/until_executed.rb +36 -0
  86. data/lib/cloudtasker/unique_job/lock/until_executing.rb +30 -0
  87. data/lib/cloudtasker/unique_job/lock/while_executing.rb +25 -0
  88. data/lib/cloudtasker/unique_job/lock_error.rb +8 -0
  89. data/lib/cloudtasker/unique_job/middleware/client.rb +15 -0
  90. data/lib/cloudtasker/unique_job/middleware/server.rb +14 -0
  91. data/lib/cloudtasker/unique_job/middleware.rb +36 -0
  92. data/lib/cloudtasker/unique_job.rb +32 -0
  93. data/lib/cloudtasker/version.rb +5 -0
  94. data/lib/cloudtasker/worker.rb +487 -0
  95. data/lib/cloudtasker/worker_handler.rb +250 -0
  96. data/lib/cloudtasker/worker_logger.rb +231 -0
  97. data/lib/cloudtasker/worker_wrapper.rb +52 -0
  98. data/lib/cloudtasker.rb +57 -0
  99. data/lib/tasks/setup_queue.rake +20 -0
  100. metadata +241 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a7faf72e0570e07dc5846e29db4d201330a045d54d6c82f1a7ce500992147f76
4
+ data.tar.gz: 6cda5d8c43ea1733493e270462557eb2f3db85ed1d6918133c7e395001ca9a35
5
+ SHA512:
6
+ metadata.gz: c3aa15b8d6236d2bbd4129aee5c8c53e58e0db1ae66cedf45e3f781c15f44997e978e78b9e373a8ef9b82a8a4d2761e3c5d0be312bf5d4f964265e2725373e83
7
+ data.tar.gz: 2fa1d711ff4d4f933b4ac595eda6fb9ef26a668e1d4613aea5970287e37a36bede4e517121e160b273eb7ced06763caa3cad21aac593309a50d8a678387f34b7
@@ -0,0 +1,15 @@
1
+ name: Rubocop
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - uses: zhulik/redis-action@1.1.0
11
+ - uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: "3.3.10"
14
+ bundler-cache: true
15
+ - run: bundle exec rubocop
@@ -0,0 +1,40 @@
1
+ name: Ruby 3.x
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby:
11
+ - "3.0"
12
+ - "3.1"
13
+ - "3.2"
14
+ - "3.3"
15
+ - "3.4"
16
+ appraisal:
17
+ - "google_cloud_tasks_1.0"
18
+ - "google_cloud_tasks_1.1"
19
+ - "google_cloud_tasks_1.2"
20
+ - "google_cloud_tasks_1.3"
21
+ - "google_cloud_tasks_1.4"
22
+ - "google_cloud_tasks_1.5"
23
+ - "google_cloud_tasks_2.0"
24
+ - "google_cloud_tasks_2.1"
25
+ - "rails_6.1"
26
+ - "rails_7.0"
27
+ - "semantic_logger_3.4"
28
+ - "semantic_logger_4.6"
29
+ - "semantic_logger_4.7.0"
30
+ - "semantic_logger_4.7.2"
31
+ env:
32
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.appraisal }}.gemfile
33
+ steps:
34
+ - uses: actions/checkout@v2
35
+ - uses: zhulik/redis-action@1.1.0
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby }}
39
+ bundler-cache: true
40
+ - run: bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /examples/*/log/*.log
7
+ /examples/rails/tmp/
8
+ /gemfiles/*.gemfile.lock
9
+ /log/
10
+ /pkg/
11
+ /spec/reports/
12
+ /spec/dummy/log/
13
+ /spec/dummy/tmp/
14
+ /tmp/
15
+
16
+ # Ignore lock files (e.g. Gemfile.lock)
17
+ /Gemfile.lock
18
+
19
+ # rspec failure tracking
20
+ .rspec_status
21
+
22
+ # Dev databases
23
+ *.sqlite3
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,96 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+ SuggestExtensions: false
6
+ TargetRubyVersion: 3.0
7
+ Exclude:
8
+ - "gemfiles/**/*"
9
+ - "vendor/**/*"
10
+
11
+ Metrics/ClassLength:
12
+ Max: 300
13
+
14
+ Metrics/ModuleLength:
15
+ Max: 150
16
+
17
+ Metrics/AbcSize:
18
+ Max: 30
19
+ Exclude:
20
+ - "spec/support/*"
21
+
22
+ Metrics/PerceivedComplexity:
23
+ Max: 20
24
+
25
+ Layout/LineLength:
26
+ Max: 120
27
+
28
+ Metrics/MethodLength:
29
+ Max: 20
30
+
31
+ RSpec/DescribeClass:
32
+ Exclude:
33
+ - "spec/integration/**/*_spec.rb"
34
+
35
+ RSpec/ExpectInHook:
36
+ Enabled: false
37
+
38
+ RSpec/EmptyLineAfterHook:
39
+ Enabled: false
40
+
41
+ RSpec/ScatteredSetup:
42
+ Enabled: false
43
+
44
+ Metrics/BlockLength:
45
+ Exclude:
46
+ - cloudtasker.gemspec
47
+ - "spec/**/*"
48
+
49
+ Style/Documentation:
50
+ Exclude:
51
+ - "examples/**/*"
52
+ - "spec/**/*"
53
+
54
+ Style/SafeNavigationChainLength:
55
+ Enabled: false
56
+
57
+ Metrics/ParameterLists:
58
+ CountKeywordArgs: false
59
+
60
+ Metrics/CyclomaticComplexity:
61
+ Max: 15
62
+
63
+ Lint/EmptyBlock:
64
+ Exclude:
65
+ - "examples/rails/config/routes.rb"
66
+
67
+ RSpec/MessageSpies:
68
+ Enabled: false
69
+
70
+ RSpec/MultipleExpectations:
71
+ Exclude:
72
+ - "examples/**/*"
73
+ - "spec/integration/**/*"
74
+
75
+ RSpec/AnyInstance:
76
+ Enabled: false
77
+
78
+ RSpec/MultipleMemoizedHelpers:
79
+ Enabled: false
80
+
81
+ RSpec/NoExpectationExample:
82
+ AllowedPatterns:
83
+ - ^expect_
84
+ - ^assert_
85
+
86
+ RSpec/IndexedLet:
87
+ Enabled: false
88
+
89
+ RSpec/StubbedMock:
90
+ Enabled: false
91
+
92
+ RSpec/VerifiedDoubles:
93
+ Exclude:
94
+ - spec/cloudtasker/cloud_task_spec.rb
95
+ - spec/cloudtasker/backend/google_cloud_task_v1_spec.rb
96
+ - spec/cloudtasker/backend/google_cloud_task_v2_spec.rb
data/Appraisals ADDED
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'google_cloud_tasks_1.0' do
4
+ gem 'google-cloud-tasks', '~> 1.0.0'
5
+ end
6
+
7
+ appraise 'google_cloud_tasks_1.1' do
8
+ gem 'google-cloud-tasks', '~> 1.1.0'
9
+ end
10
+
11
+ appraise 'google_cloud_tasks_1.2' do
12
+ gem 'google-cloud-tasks', '~> 1.2.0'
13
+ end
14
+
15
+ appraise 'google_cloud_tasks_1.3' do
16
+ gem 'google-cloud-tasks', '~> 1.3.0'
17
+ end
18
+
19
+ appraise 'google_cloud_tasks_1.4' do
20
+ gem 'google-cloud-tasks', '~> 1.4.0'
21
+ end
22
+
23
+ appraise 'google_cloud_tasks_1.5' do
24
+ gem 'google-cloud-tasks', '~> 1.5.0'
25
+ end
26
+
27
+ appraise 'google_cloud_tasks_2.0' do
28
+ gem 'google-cloud-tasks', '~> 2.0.0'
29
+ end
30
+
31
+ appraise 'google_cloud_tasks_2.1' do
32
+ gem 'google-cloud-tasks', '~> 2.1.0'
33
+ end
34
+
35
+ appraise 'rails_6.1' do
36
+ gem 'rails', '~> 6.1.0'
37
+ gem 'rspec-rails'
38
+ gem 'mutex_m'
39
+ gem 'drb'
40
+ end
41
+
42
+ appraise 'rails_7.0' do
43
+ gem 'rails', '~> 7.0.0'
44
+ gem 'rspec-rails'
45
+ end
46
+
47
+ appraise 'rails_7.1' do
48
+ gem 'rails', '~> 7.1'
49
+ gem 'rspec-rails'
50
+ end
51
+
52
+ appraise 'rails_8.0' do
53
+ gem 'rails', '~> 8.0'
54
+ gem 'rspec-rails'
55
+ end
56
+
57
+ appraise 'rails_8.1' do
58
+ gem 'rails', '~> 8.1'
59
+ gem 'rspec-rails'
60
+ end
61
+
62
+ appraise 'semantic_logger_3.4' do
63
+ gem 'semantic_logger', '3.4.1'
64
+ end
65
+
66
+ appraise 'semantic_logger_4.6' do
67
+ gem 'semantic_logger', '4.6.1'
68
+ end
69
+
70
+ appraise 'semantic_logger_4.7.0' do
71
+ gem 'semantic_logger', '4.7.0'
72
+ end
73
+
74
+ appraise 'semantic_logger_4.7.2' do
75
+ gem 'semantic_logger', '4.7.2'
76
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,248 @@
1
+ # Changelog
2
+
3
+ ## [v0.15.rc3](https://github.com/keypup-io/cloudtasker/tree/v0.15.rc3) (2025-11-17)
4
+
5
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.14.0...v0.15.rc3)
6
+
7
+ **Improvements:**
8
+ - Queues: support `propagate_queue: true` option on `cloudtasker_options` to make workers enqueued inside a job use the runtime queue instead of the default (class-configured or `default`) queue.
9
+ - Unique Jobs: add `until_completed` strategy to lock jobs until they are completed or have exhausted all retries (thanks @jam-packed).
10
+ - Workers: provide `perform_now` method to perform job inline and align with other job frameworks
11
+
12
+ **Maintenance:**
13
+ - Supported rubies: drop support for ruby `2.7`. Cloudtasker now requires ruby `3.0` and above.
14
+
15
+ ## [v0.14.0](https://github.com/keypup-io/cloudtasker/tree/v0.14.0) (2025-02-11)
16
+
17
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.13.2...v0.14.0)
18
+
19
+ **Improvements:**
20
+ - Authentication: To support OIDC and regular Cloudtasker authentication, we moved the Cloudtasker Authentication header from `Authorization` to `X-Cloudtasker-Authorization`. Backward compatibility is maintained for existing jobs.
21
+ - Authentication: Use signature-based authentication instead of plain tokens. The authentication token now HMACs the content of the job. This approach prevents token from being reused.
22
+ - Batch Jobs: Batch job progress and statistics are now calculated using counters, instead of checking every job. This is much faster.
23
+ - Cron Validation: The cron jobs extension now fails epicly if the cron configuration is invalid, instead of failing silently.
24
+ - GCP OIDC Authentification: It is now possible to specify an Open ID Connect (OIDC) service account to run Cloudtasker on private Cloud Run services. OIDC authentication is provided as an extra authentication layer on top of the regular Cloudtasker authentication system (see below). See the OIDC section in the [initializer documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#cloudtasker-initializer).
25
+ - Job Execution Control: Add ability to conditionally raise `Cloudtasker::RetryWorkerError` to retry jobs. This error does not get logged but the retry count will still be increased. This is a safer approach than using the `reenqueue` helper, which can lead to forever running jobs if not used properly. [Documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#conditional-reenqueues-using-retry-errors).
26
+ - Log Arguments Truncation: Add `Cloudtasker::WorkerLogger.truncate` helper to truncate large payloads. This is useful to log the top-level attributes of hash/array payloads, without logging the full depth. This case save you significant $$ in logging costs. [Documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#truncating-log-arguments).
27
+ - Storable Jobs: Add an interface to park Cloudtasker jobs that need to be conditionally run later. This is useful when you need to capture jobs (and their arguments) during a batch but only enqueue them after the batch is completed. This extension requires Redis and is provided as an optional module. [Documentation](https://github.com/keypup-io/cloudtasker/blob/master/docs/STORABLE_JOBS.md).
28
+ - Local Server: Add ability to disable SSL verification on the local server when local HTTPS endpoints are used. See the `local_server_ssl_verify` section in the [initializer documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#cloudtasker-initializer).
29
+
30
+ **Fixed bugs:**
31
+ - ActiveJob: Support `enqueue_after_transaction_commit?` to be ISO with the ActiveJob interface.
32
+ - Batch Jobs: Do not register batch jobs that were not actually enqueued due to other factors (e.g. Job Uniqueness extension). This issue could lead to never-ending batches.
33
+ - Duration Logging: Specify the unit (`s` for seconds) on the job duration attribute so it gets properly picked up by GCP Logging. GCP Logging was occasionally mixing up seconds and milliseconds.
34
+ - Job Retry Count: GCP fixed their retry count header some time ago. We now use the `X-CloudTasks-TaskExecutionCount` header instead of the `X-CloudTasks-TaskRetryCount`. [See more details here](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#max-retries).
35
+ - Rails: Use `skip_forgery_protection` instead of `skip_before_action`. The later was causing occasional issues on some setups.
36
+
37
+
38
+ ## [v0.13.2](https://github.com/keypup-io/cloudtasker/tree/v0.13.2) (2023-07-02)
39
+
40
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.13.1...v0.13.2)
41
+
42
+ **Fixed bugs:**
43
+ - Fix concurrency issue when draining test jobs in `fake!` mode
44
+
45
+ ## [v0.13.1](https://github.com/keypup-io/cloudtasker/tree/v0.13.1) (2023-06-19)
46
+
47
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.13.0...v0.13.1)
48
+
49
+ **Fixed bugs:**
50
+ - Batch jobs: Gracefully handle errors (e.g. Redis connection error) while setting up child jobs. Previously this could lead to ghost child jobs preventing the parent batch from finishing (child job is registered but is never enqueued)
51
+ - Protobuf: fix formatting of protobuf payload by removig `nil` values and formatting the `dispatch_deadline` as a proper `Google::Protobuf::Duration` (instead of `integer`). Fixes [#94](https://github.com/keypup-io/cloudtasker/issues/94)
52
+
53
+
54
+ ## [v0.13.0](https://github.com/keypup-io/cloudtasker/tree/v0.13.0) (2022-03-11)
55
+
56
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.2...v0.13.0)
57
+
58
+ **Improvements:**
59
+ - Dependencies: add support for google-cloud-tasks v2 and while keeping backward compatibility with v1. For existing projects, you may need to run `bundle update google-cloud-tasks` after upgrading cloudtasker to update google-cloud-tasks to the latest version.
60
+ - Ruby 3: Rework method arguments to be compatible with Ruby 3
61
+ - Tests: Separate test environment for Ruby 2 and Ruby 3
62
+ - Tests: Do not load Rails by default and skip Rails-specific tests in non-Rails appraisals
63
+
64
+ ## [v0.12.2](https://github.com/keypup-io/cloudtasker/tree/v0.12.2) (2021-12-31)
65
+
66
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.1...v0.12.2)
67
+
68
+ **Fixed bugs:**
69
+ - Local server: Fix race condition on thread processing. See [#46](https://github.com/keypup-io/cloudtasker/pull/46)
70
+ - Non-Rails: Fix `arguments_missing?` check for non-rails projects.
71
+
72
+ ## [v0.12.1](https://github.com/keypup-io/cloudtasker/tree/v0.12.1) (2021-08-25)
73
+
74
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.0...v0.12.1)
75
+
76
+ **Fixed bugs:**
77
+ - Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
78
+ - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
79
+
80
+ ## [v0.11.1](https://github.com/keypup-io/cloudtasker/tree/v0.11.1) (2021-08-25)
81
+
82
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.11.1)
83
+
84
+ **Fixed bugs:**
85
+ - Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
86
+ - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
87
+
88
+ ## [v0.10.2](https://github.com/keypup-io/cloudtasker/tree/v0.10.2) (2021-08-25)
89
+
90
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.1...v0.10.2)
91
+
92
+ **Fixed bugs:**
93
+ - Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
94
+ - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
95
+
96
+ ## [v0.9.5](https://github.com/keypup-io/cloudtasker/tree/v0.9.5) (2021-08-25)
97
+
98
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.4...v0.9.5)
99
+
100
+ **Fixed bugs:**
101
+ - Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
102
+ - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
103
+
104
+ ## [v0.12.0](https://github.com/keypup-io/cloudtasker/tree/v0.12.0) (2021-08-19)
105
+
106
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.12.0)
107
+
108
+ **Improvements:**
109
+ - ActiveJob: do not double log errors (ActiveJob has its own error logging)
110
+ - Batch callbacks: Retry jobs when completion callback fails
111
+ - Batch state: use native Redis hashes to store batch state instead of a serialized hash in a string key
112
+ - 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.
113
+ - Batch redis usage: cleanup batches as they get completed or become dead to avoid excessive redis usage with large batches.
114
+ - Batch expansion: Inject `parent_batch` in jobs. Can be used to expand the parent batch the job is in.
115
+ - Configuration: allow configuration of Cloud Tasks `dispatch deadline` at global and worker level
116
+ - Configuration: allow specifying global `on_error` and `on_dead` callbacks for error reporting
117
+ - Cron jobs: Use Redis Sets instead of key pattern matching for resource listing
118
+ - Error logging: Use worker logger so as to include context (job args etc.)
119
+ - Error logging: Do not log exception and stack trace separately, combine them instead.
120
+ - Local server: Use Redis Sets instead of key pattern matching for resource listing
121
+ - Local server: Guard against nil tasks to prevent job daemon failures
122
+ - Performance: remove use of redis locks and rely on atomic transactions instead for Batch and Unique Job.
123
+ - Worker: raise DeadWorkerError instead of MissingWorkerArgumentsError when arguments are missing. This is more consistent with what middlewares expect.
124
+ - Worker redis usage: delete redis payload storage once the job is successful or dead instead of expiring the key.
125
+
126
+ **Fixed bugs:**
127
+ - Retries: Enforce job retry limit on job processing. There was an edge case where jobs could be retried indefinitely on batch callback errors.
128
+
129
+ ## [v0.11.0](https://github.com/keypup-io/cloudtasker/tree/v0.11.0) (2020-11-23)
130
+
131
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.0...v0.11.0)
132
+
133
+ **Improvements:**
134
+ - Worker: drop job (return 205 response) when worker arguments are not available (e.g. arguments were stored in Redis and the latter was flushed)
135
+ - Rails: add ActiveJob adapter (thanks @vovimayhem)
136
+
137
+ ## [v0.10.1](https://github.com/keypup-io/cloudtasker/tree/v0.10.1) (2020-10-05)
138
+
139
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.0...v0.10.1)
140
+
141
+ **Fixed bugs:**
142
+ - Local server: delete dead task from local server queue
143
+ - Logging: fix log processing with `semantic_logger` `v4.7.2`. Accept any args on block passed to the logger.
144
+ - Worker: fix configuration of `max_retries` at worker level
145
+
146
+ ## [v0.10.0](https://github.com/keypup-io/cloudtasker/tree/v0.10.0) (2020-09-02)
147
+
148
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.3...v0.10.0)
149
+
150
+ **Improvements:**
151
+ - Logging: Add worker name in log messages
152
+ - Logging: Add job duration in log messages
153
+ - Logging: Add Cloud Cloud Task ID in log messages
154
+ - Unique Job: Support TTL for lock keys. This feature prevents queues from being dead-locked when a critical crash occurs while processing a unique job.
155
+ - Worker: support payload storage in Redis instead of sending the payload to Google Cloud Tasks. This is useful when job arguments are expected to exceed 100kb, which is the limit set by Google Cloud Tasks
156
+
157
+ **Fixed bugs:**
158
+ - Local processing error: improve error handling and retries around network interruptions
159
+ - Redis client: prevent deadlocks in high concurrency scenario by slowing down poll time and enforcing lock expiration
160
+ - Redis client: use connecion pool with Redis to prevent race conditions
161
+ - Google API: improve error handling on job creation
162
+ - Google API: use the `X-CloudTasks-TaskRetryCount` instead of `X-CloudTasks-TaskExecutionCount` to detect how many retries Google Cloud Tasks has performed. Using `X-CloudTasks-TaskRetryCount` is theoretically less accurate than using `X-CloudTasks-TaskExecutionCount` because it includes the number of "app unreachable" retries but `X-CloudTasks-TaskExecutionCount` is currently bugged and remains at zero all the time. See [this issue](https://github.com/keypup-io/cloudtasker/issues/6)
163
+
164
+ ## [v0.9.4](https://github.com/keypup-io/cloudtasker/tree/v0.9.4) (2020-10-05)
165
+
166
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.3...v0.9.4)
167
+
168
+ **Fixed bugs:**
169
+ - Logging: fix log processing with `semantic_logger` `v4.7.2`. Accept any args on block passed to the logger.
170
+
171
+ ## [v0.9.3](https://github.com/keypup-io/cloudtasker/tree/v0.9.3) (2020-06-25)
172
+
173
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.2...v0.9.3)
174
+
175
+ **Fixed bugs:**
176
+ - Google Cloud Tasks: lock version to `~> 1.0` (Google recently released a v2 which changes its bindings completely). An [issue](https://github.com/keypup-io/cloudtasker/issues/11) has been raised to upgrade Cloudtasker to `google-cloud-tasks` `v2`.
177
+
178
+ ## [v0.9.2](https://github.com/keypup-io/cloudtasker/tree/v0.9.2) (2020-03-04)
179
+
180
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.1...v0.9.2)
181
+
182
+ **Fixed bugs:**
183
+ - Cloud Task: ignore "not found" errors when trying to delete an already deleted task.
184
+
185
+ ## [v0.9.1](https://github.com/keypup-io/cloudtasker/tree/v0.9.1) (2020-02-11)
186
+
187
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.0...v0.9.1)
188
+
189
+ **Fixed bugs:**
190
+ - Cloud Task: raise `Cloudtasker::MaxTaskSizeExceededError` if job payload exceeds 100 KB. This is mainly to have production parity in development when running the local processing server.
191
+
192
+ ## [v0.9.0](https://github.com/keypup-io/cloudtasker/tree/v0.9.0) (2020-01-23)
193
+
194
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.8.2...v0.9.0)
195
+
196
+ **Fixed bugs:**
197
+ - Cloud Task: Base64 encode task body to support UTF-8 characters (e.g. emojis).
198
+ - Redis: Restrict to one connection (class level) to avoid too many DNS lookups
199
+
200
+ **Migration**
201
+ For Sinatra applications please update your Cloudtasker controller according to [this diff](https://github.com/keypup-io/cloudtasker/commit/311fa8f9beec91fbae012164a25b2ee6e261a2e4#diff-c2a0ea6c6e6c31c749d2e1acdc574f0f).
202
+
203
+ ## [v0.8.2](https://github.com/keypup-io/cloudtasker/tree/v0.8.2) (2019-12-05)
204
+
205
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.8.1...v0.8.2)
206
+
207
+ **Fixed bugs:**
208
+ - Config: do not add processor host to `Rails.application.config.hosts` if originally empty.
209
+
210
+ ## [v0.8.1](https://github.com/keypup-io/cloudtasker/tree/v0.8.1) (2019-12-03)
211
+
212
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.8.0...v0.8.1)
213
+
214
+ **Fixed bugs:**
215
+ - Local dev server: ensure job queue name is kept when taks is retried
216
+ - Rails/Controller: bypass Rails munge logic to preserve nil values inside job arguments.
217
+
218
+ ## [v0.8.0](https://github.com/keypup-io/cloudtasker/tree/v0.8.0) (2019-11-27)
219
+
220
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.7.0...v0.8.0)
221
+
222
+ ## [v0.7.0](https://github.com/keypup-io/cloudtasker/tree/v0.7.0) (2019-11-25)
223
+
224
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.6.0...v0.7.0)
225
+
226
+ ## [v0.6.0](https://github.com/keypup-io/cloudtasker/tree/v0.6.0) (2019-11-25)
227
+
228
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.5.0...v0.6.0)
229
+
230
+ ## [v0.5.0](https://github.com/keypup-io/cloudtasker/tree/v0.5.0) (2019-11-25)
231
+
232
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.4.0...v0.5.0)
233
+
234
+ ## [v0.4.0](https://github.com/keypup-io/cloudtasker/tree/v0.4.0) (2019-11-25)
235
+
236
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.3.0...v0.4.0)
237
+
238
+ ## [v0.3.0](https://github.com/keypup-io/cloudtasker/tree/v0.3.0) (2019-11-25)
239
+
240
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.2.0...v0.3.0)
241
+
242
+ ## [v0.2.0](https://github.com/keypup-io/cloudtasker/tree/v0.2.0) (2019-11-18)
243
+
244
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.1.0...v0.2.0)
245
+
246
+ ## [v0.1.0](https://github.com/keypup-io/cloudtasker/tree/v0.1.0) (2019-11-17)
247
+
248
+ [Full Changelog](https://github.com/keypup-io/cloudtasker/compare/c137feb1ceaaaa4e2fecac0d1f0b4c73151ae002...v0.1.0)
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at arnaud.lachaume@maestrano.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in cloudtasker.gemspec
6
+ gemspec
7
+
8
+ # Dev dependencies
9
+ gem 'appraisal'
10
+ gem 'bundler', '~> 2.0'
11
+ gem 'rake', '>= 12.3.3'
12
+ gem 'rspec', '~> 3.0'
13
+ gem 'rspec-json_expectations', '~> 2.2'
14
+ gem 'rubocop', '~> 1.75.2'
15
+ gem 'rubocop-rspec', '~> 3.0.1'
16
+ gem 'semantic_logger'
17
+ gem 'timecop'
18
+ gem 'webmock'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Arnaud Lachaume
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.