cloudtasker 0.12.0 → 0.13.rc2
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.
- checksums.yaml +4 -4
- data/.github/workflows/lint_rubocop.yml +20 -0
- data/.github/workflows/{test.yml → test_ruby_2.5_2.6.yml} +12 -13
- data/.github/workflows/test_ruby_2.7.yml +44 -0
- data/.github/workflows/test_ruby_3.x.yml +43 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -0
- data/Appraisals +52 -8
- data/CHANGELOG.md +51 -1
- data/README.md +14 -3
- data/Rakefile +0 -6
- data/app/controllers/cloudtasker/worker_controller.rb +4 -1
- data/cloudtasker.gemspec +1 -6
- data/docs/CRON_JOBS.md +39 -0
- data/gemfiles/google_cloud_tasks_1.0.gemfile +2 -1
- data/gemfiles/google_cloud_tasks_1.1.gemfile +2 -1
- data/gemfiles/google_cloud_tasks_1.2.gemfile +2 -1
- data/gemfiles/google_cloud_tasks_1.3.gemfile +2 -1
- data/gemfiles/google_cloud_tasks_1.4.gemfile +8 -0
- data/gemfiles/google_cloud_tasks_1.5.gemfile +8 -0
- data/gemfiles/google_cloud_tasks_2.0.gemfile +8 -0
- data/gemfiles/google_cloud_tasks_2.1.gemfile +8 -0
- data/gemfiles/rails_5.2.gemfile +1 -0
- data/gemfiles/rails_6.0.gemfile +1 -0
- data/gemfiles/{semantic_logger_4.7.gemfile → rails_6.1.gemfile} +2 -1
- data/gemfiles/rails_7.0.gemfile +8 -0
- data/gemfiles/semantic_logger_3.4.gemfile +1 -0
- data/gemfiles/semantic_logger_4.6.gemfile +1 -0
- data/gemfiles/semantic_logger_4.7.0.gemfile +1 -0
- data/gemfiles/semantic_logger_4.7.2.gemfile +1 -0
- data/lib/cloudtasker/backend/{google_cloud_task.rb → google_cloud_task_v1.rb} +15 -11
- data/lib/cloudtasker/backend/google_cloud_task_v2.rb +210 -0
- data/lib/cloudtasker/backend/memory_task.rb +1 -1
- data/lib/cloudtasker/backend/redis_task.rb +7 -3
- data/lib/cloudtasker/cloud_task.rb +43 -5
- data/lib/cloudtasker/cron/schedule.rb +7 -7
- data/lib/cloudtasker/local_server.rb +1 -1
- data/lib/cloudtasker/redis_client.rb +39 -14
- data/lib/cloudtasker/unique_job/job.rb +3 -2
- data/lib/cloudtasker/unique_job/middleware/client.rb +2 -1
- data/lib/cloudtasker/version.rb +1 -1
- data/lib/cloudtasker/worker.rb +4 -4
- data/lib/cloudtasker/worker_wrapper.rb +1 -1
- data/lib/cloudtasker.rb +1 -0
- data/lib/tasks/setup_queue.rake +2 -2
- metadata +21 -80
- data/app/controllers/cloudtasker/application_controller.rb +0 -8
- data/gemfiles/google_cloud_tasks_1.0.gemfile.lock +0 -341
- data/gemfiles/google_cloud_tasks_1.1.gemfile.lock +0 -341
- data/gemfiles/google_cloud_tasks_1.2.gemfile.lock +0 -341
- data/gemfiles/google_cloud_tasks_1.3.gemfile.lock +0 -342
- data/gemfiles/rails_4.0.gemfile +0 -10
- data/gemfiles/rails_4.1.gemfile +0 -9
- data/gemfiles/rails_4.2.gemfile +0 -9
- data/gemfiles/rails_5.0.gemfile +0 -9
- data/gemfiles/rails_5.1.gemfile +0 -9
- data/gemfiles/rails_5.2.gemfile.lock +0 -326
- data/gemfiles/rails_6.0.gemfile.lock +0 -342
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ea79ae390a67c57e19fade2cd70235dab2cc2b2d115c40510489f93e8ecd509
|
|
4
|
+
data.tar.gz: 20760c5bffa058a32678bd07778f3fa375361cf6fc7bb1e57dfa54ed49b6cd72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fce5e6ddf114647299a6ffded2a43c07417bbd5e58fc62d1eb1bd4d2d0d93ae4ff13a2beb952286a3a761fb6551c422aef3b10707f4121681540372e4da2a23b
|
|
7
|
+
data.tar.gz: a4f828a6780d506067fd0d8207e140a1f0473252a1444020cbae1c7cc278260700ea5fe3111ab07f415a14b0790a4833b43939ad80695bf1525e530794668b96
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
- name: Set up Ruby
|
|
12
|
+
uses: ruby/setup-ruby@v1
|
|
13
|
+
with:
|
|
14
|
+
ruby-version: '3.0.1'
|
|
15
|
+
bundler-cache: true
|
|
16
|
+
- name: Lint codebase
|
|
17
|
+
run: |
|
|
18
|
+
gem install bundler
|
|
19
|
+
bundle install --jobs 4 --retry 3
|
|
20
|
+
bundle exec rubocop
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Ruby 2.5/2.6
|
|
2
2
|
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master, 0.9-stable ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ master, 0.9-stable ]
|
|
3
|
+
on: [push, pull_request]
|
|
8
4
|
|
|
9
5
|
jobs:
|
|
10
6
|
build:
|
|
@@ -12,34 +8,37 @@ jobs:
|
|
|
12
8
|
strategy:
|
|
13
9
|
matrix:
|
|
14
10
|
ruby:
|
|
15
|
-
- '2.5.
|
|
16
|
-
- '2.6.
|
|
11
|
+
- '2.5.9'
|
|
12
|
+
- '2.6.7'
|
|
17
13
|
appraisal:
|
|
18
14
|
- 'google-cloud-tasks-1.0'
|
|
19
15
|
- 'google-cloud-tasks-1.1'
|
|
20
16
|
- 'google-cloud-tasks-1.2'
|
|
21
17
|
- 'google-cloud-tasks-1.3'
|
|
18
|
+
- 'google-cloud-tasks-1.4'
|
|
19
|
+
- 'google-cloud-tasks-1.5'
|
|
20
|
+
- 'google-cloud-tasks-2.0'
|
|
21
|
+
- 'google-cloud-tasks-2.1'
|
|
22
22
|
- 'rails-5.2'
|
|
23
23
|
- 'rails-6.0'
|
|
24
|
+
- 'rails-6.1'
|
|
24
25
|
- 'semantic_logger-3.4'
|
|
25
26
|
- 'semantic_logger-4.6'
|
|
26
27
|
- 'semantic_logger-4.7.0'
|
|
27
28
|
- 'semantic_logger-4.7.2'
|
|
28
29
|
steps:
|
|
29
|
-
- name: Setup System
|
|
30
|
-
run: sudo apt-get install libsqlite3-dev
|
|
31
30
|
- uses: actions/checkout@v2
|
|
32
31
|
- uses: zhulik/redis-action@1.1.0
|
|
33
|
-
- name: Set up Ruby
|
|
34
|
-
uses:
|
|
32
|
+
- name: Set up Ruby
|
|
33
|
+
uses: ruby/setup-ruby@v1
|
|
35
34
|
with:
|
|
36
35
|
ruby-version: ${{ matrix.ruby }}
|
|
36
|
+
bundler-cache: true
|
|
37
37
|
- name: Build and test with Rake
|
|
38
38
|
env:
|
|
39
39
|
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
|
40
40
|
run: |
|
|
41
41
|
gem install bundler
|
|
42
42
|
bundle install --jobs 4 --retry 3
|
|
43
|
-
bundle exec rubocop
|
|
44
43
|
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
|
45
44
|
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Ruby 2.7
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby:
|
|
11
|
+
- '2.7.5'
|
|
12
|
+
appraisal:
|
|
13
|
+
- 'google-cloud-tasks-1.0'
|
|
14
|
+
- 'google-cloud-tasks-1.1'
|
|
15
|
+
- 'google-cloud-tasks-1.2'
|
|
16
|
+
- 'google-cloud-tasks-1.3'
|
|
17
|
+
- 'google-cloud-tasks-1.4'
|
|
18
|
+
- 'google-cloud-tasks-1.5'
|
|
19
|
+
- 'google-cloud-tasks-2.0'
|
|
20
|
+
- 'google-cloud-tasks-2.1'
|
|
21
|
+
- 'rails-5.2'
|
|
22
|
+
- 'rails-6.0'
|
|
23
|
+
- 'rails-6.1'
|
|
24
|
+
- 'rails-7.0'
|
|
25
|
+
- 'semantic_logger-3.4'
|
|
26
|
+
- 'semantic_logger-4.6'
|
|
27
|
+
- 'semantic_logger-4.7.0'
|
|
28
|
+
- 'semantic_logger-4.7.2'
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v2
|
|
31
|
+
- uses: zhulik/redis-action@1.1.0
|
|
32
|
+
- name: Set up Ruby
|
|
33
|
+
uses: ruby/setup-ruby@v1
|
|
34
|
+
with:
|
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
|
36
|
+
bundler-cache: true
|
|
37
|
+
- name: Build and test with Rake
|
|
38
|
+
env:
|
|
39
|
+
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
|
40
|
+
run: |
|
|
41
|
+
gem install bundler
|
|
42
|
+
bundle install --jobs 4 --retry 3
|
|
43
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
|
44
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
|
@@ -0,0 +1,43 @@
|
|
|
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.1'
|
|
12
|
+
# - '3.1.0'
|
|
13
|
+
appraisal:
|
|
14
|
+
- 'google-cloud-tasks-1.0'
|
|
15
|
+
- 'google-cloud-tasks-1.1'
|
|
16
|
+
- 'google-cloud-tasks-1.2'
|
|
17
|
+
- 'google-cloud-tasks-1.3'
|
|
18
|
+
- 'google-cloud-tasks-1.4'
|
|
19
|
+
- 'google-cloud-tasks-1.5'
|
|
20
|
+
- 'google-cloud-tasks-2.0'
|
|
21
|
+
- 'google-cloud-tasks-2.1'
|
|
22
|
+
- 'rails-6.1'
|
|
23
|
+
- 'rails-7.0'
|
|
24
|
+
- 'semantic_logger-3.4'
|
|
25
|
+
- 'semantic_logger-4.6'
|
|
26
|
+
- 'semantic_logger-4.7.0'
|
|
27
|
+
- 'semantic_logger-4.7.2'
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v2
|
|
30
|
+
- uses: zhulik/redis-action@1.1.0
|
|
31
|
+
- name: Set up Ruby
|
|
32
|
+
uses: ruby/setup-ruby@v1
|
|
33
|
+
with:
|
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
|
35
|
+
bundler-cache: true
|
|
36
|
+
- name: Build and test with Rake
|
|
37
|
+
env:
|
|
38
|
+
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
|
39
|
+
run: |
|
|
40
|
+
gem install bundler
|
|
41
|
+
bundle install --jobs 4 --retry 3
|
|
42
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
|
43
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -5,6 +5,11 @@ AllCops:
|
|
|
5
5
|
- 'gemfiles/**/*'
|
|
6
6
|
- 'vendor/**/*'
|
|
7
7
|
|
|
8
|
+
# Ruby 3.0: curly braces around last argument has meaning
|
|
9
|
+
# See: https://github.com/rubocop/rubocop/issues/7641
|
|
10
|
+
Style/BracesAroundHashParameters:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
8
13
|
Metrics/ClassLength:
|
|
9
14
|
Max: 200
|
|
10
15
|
|
data/Appraisals
CHANGED
|
@@ -1,41 +1,85 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
appraise 'google-cloud-tasks-1.0' do
|
|
4
|
-
gem '
|
|
4
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
5
|
+
gem 'google-cloud-tasks', '~> 1.0.0'
|
|
5
6
|
end
|
|
6
7
|
|
|
7
8
|
appraise 'google-cloud-tasks-1.1' do
|
|
8
|
-
gem '
|
|
9
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
10
|
+
gem 'google-cloud-tasks', '~> 1.1.0'
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
appraise 'google-cloud-tasks-1.2' do
|
|
12
|
-
gem '
|
|
14
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
15
|
+
gem 'google-cloud-tasks', '~> 1.2.0'
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
appraise 'google-cloud-tasks-1.3' do
|
|
16
|
-
gem '
|
|
19
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
20
|
+
gem 'google-cloud-tasks', '~> 1.3.0'
|
|
17
21
|
end
|
|
18
22
|
|
|
19
|
-
appraise '
|
|
20
|
-
gem '
|
|
23
|
+
appraise 'google-cloud-tasks-1.4' do
|
|
24
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
25
|
+
gem 'google-cloud-tasks', '~> 1.4.0'
|
|
21
26
|
end
|
|
22
27
|
|
|
23
|
-
appraise '
|
|
24
|
-
gem '
|
|
28
|
+
appraise 'google-cloud-tasks-1.5' do
|
|
29
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
30
|
+
gem 'google-cloud-tasks', '~> 1.5.0'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
appraise 'google-cloud-tasks-2.0' do
|
|
34
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
35
|
+
gem 'google-cloud-tasks', '~> 2.0.0'
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
appraise 'google-cloud-tasks-2.1' do
|
|
39
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
40
|
+
gem 'google-cloud-tasks', '~> 2.1.0'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if RUBY_VERSION < '3'
|
|
44
|
+
appraise 'rails-5.2' do
|
|
45
|
+
gem 'rails', '5.2'
|
|
46
|
+
gem 'rspec-rails'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
appraise 'rails-6.0' do
|
|
50
|
+
gem 'rails', '6.0'
|
|
51
|
+
gem 'rspec-rails'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
appraise 'rails-6.1' do
|
|
56
|
+
gem 'rails', '6.1'
|
|
57
|
+
gem 'rspec-rails'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
if RUBY_VERSION >= '2.7'
|
|
61
|
+
appraise 'rails-7.0' do
|
|
62
|
+
gem 'rails', '7.0'
|
|
63
|
+
gem 'rspec-rails'
|
|
64
|
+
end
|
|
25
65
|
end
|
|
26
66
|
|
|
27
67
|
appraise 'semantic_logger-3.4' do
|
|
68
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
28
69
|
gem 'semantic_logger', '3.4.1'
|
|
29
70
|
end
|
|
30
71
|
|
|
31
72
|
appraise 'semantic_logger-4.6' do
|
|
73
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
32
74
|
gem 'semantic_logger', '4.6.1'
|
|
33
75
|
end
|
|
34
76
|
|
|
35
77
|
appraise 'semantic_logger-4.7.0' do
|
|
78
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
36
79
|
gem 'semantic_logger', '4.7.0'
|
|
37
80
|
end
|
|
38
81
|
|
|
39
82
|
appraise 'semantic_logger-4.7.2' do
|
|
83
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
40
84
|
gem 'semantic_logger', '4.7.2'
|
|
41
85
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v0.13.rc2](https://github.com/keypup-io/cloudtasker/tree/v0.13.rc2) (2022-01-25)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.2...v0.13.rc2)
|
|
6
|
+
|
|
7
|
+
**Improvements:**
|
|
8
|
+
- 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.
|
|
9
|
+
- Ruby 3: Rework method arguments to be compatible with Ruby 3
|
|
10
|
+
- Tests: Separate test environment for Ruby 2 and Ruby 3
|
|
11
|
+
- Tests: Do not load Rails by default and skip Rails-specific tests in non-Rails appraisals
|
|
12
|
+
|
|
13
|
+
## [v0.12.2](https://github.com/keypup-io/cloudtasker/tree/v0.12.2) (2021-12-31)
|
|
14
|
+
|
|
15
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.1...v0.12.2)
|
|
16
|
+
|
|
17
|
+
**Fixed bugs:**
|
|
18
|
+
- Local server: Fix race condition on thread processing. See [#46](https://github.com/keypup-io/cloudtasker/pull/46)
|
|
19
|
+
- Non-Rails: Fix `arguments_missing?` check for non-rails projects.
|
|
20
|
+
|
|
21
|
+
## [v0.12.1](https://github.com/keypup-io/cloudtasker/tree/v0.12.1) (2021-08-25)
|
|
22
|
+
|
|
23
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.0...v0.12.1)
|
|
24
|
+
|
|
25
|
+
**Fixed bugs:**
|
|
26
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
|
27
|
+
- 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)
|
|
28
|
+
|
|
29
|
+
## [v0.11.1](https://github.com/keypup-io/cloudtasker/tree/v0.11.1) (2021-08-25)
|
|
30
|
+
|
|
31
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.11.1)
|
|
32
|
+
|
|
33
|
+
**Fixed bugs:**
|
|
34
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
|
35
|
+
- 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)
|
|
36
|
+
|
|
37
|
+
## [v0.10.2](https://github.com/keypup-io/cloudtasker/tree/v0.10.2) (2021-08-25)
|
|
38
|
+
|
|
39
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.1...v0.10.2)
|
|
40
|
+
|
|
41
|
+
**Fixed bugs:**
|
|
42
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
|
43
|
+
- 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)
|
|
44
|
+
|
|
45
|
+
## [v0.9.5](https://github.com/keypup-io/cloudtasker/tree/v0.9.5) (2021-08-25)
|
|
46
|
+
|
|
47
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.4...v0.9.5)
|
|
48
|
+
|
|
49
|
+
**Fixed bugs:**
|
|
50
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
|
51
|
+
- 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)
|
|
52
|
+
|
|
3
53
|
## [v0.12.0](https://github.com/keypup-io/cloudtasker/tree/v0.12.0) (2021-08-19)
|
|
4
54
|
|
|
5
55
|
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.12.0)
|
|
@@ -25,7 +75,7 @@
|
|
|
25
75
|
**Fixed bugs:**
|
|
26
76
|
- Retries: Enforce job retry limit on job processing. There was an edge case where jobs could be retried indefinitely on batch callback errors.
|
|
27
77
|
|
|
28
|
-
## [v0.11.0](https://github.com/keypup-io/cloudtasker/tree/v0.11.0) (
|
|
78
|
+
## [v0.11.0](https://github.com/keypup-io/cloudtasker/tree/v0.11.0) (2020-11-23)
|
|
29
79
|
|
|
30
80
|
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.0...v0.11.0)
|
|
31
81
|
|
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Cloudtasker also provides optional modules for running [cron jobs](docs/CRON_JOB
|
|
|
12
12
|
|
|
13
13
|
A local processing server is also available for development. This local server processes jobs in lieu of Cloud Tasks and allows you to work offline.
|
|
14
14
|
|
|
15
|
-
**Maturity**: This gem is production-ready. We at Keypup have already processed millions of jobs using Cloudtasker and all related extensions (cron, batch and unique jobs). We are planning to release the official `v1.0.0` somewhere in
|
|
15
|
+
**Maturity**: This gem is production-ready. We at Keypup have already processed millions of jobs using Cloudtasker and all related extensions (cron, batch and unique jobs). We are planning to release the official `v1.0.0` somewhere in 2022, in case we've missed any edge-case bug.
|
|
16
16
|
|
|
17
17
|
## Summary
|
|
18
18
|
|
|
@@ -51,6 +51,9 @@ Add this line to your application's Gemfile:
|
|
|
51
51
|
|
|
52
52
|
```ruby
|
|
53
53
|
gem 'cloudtasker'
|
|
54
|
+
|
|
55
|
+
# For Ruby 3 support, please use v0.13.rc1
|
|
56
|
+
gem 'cloudtasker, '~> 0.13.rc1'
|
|
54
57
|
```
|
|
55
58
|
|
|
56
59
|
And then execute:
|
|
@@ -1087,9 +1090,17 @@ To size the concurrency of your queues you should therefore take the most limiti
|
|
|
1087
1090
|
|
|
1088
1091
|
## Development
|
|
1089
1092
|
|
|
1090
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
|
1093
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
|
1094
|
+
|
|
1095
|
+
For tests, run `rake` to run the tests. Note that Rails is not in context by default, which means Rails-specific test will not run.
|
|
1096
|
+
For tests including Rails-specific tests, run `bundle exec appraisal rails-7.0 rake`
|
|
1097
|
+
For all context-specific tests (incl. Rails), run the [appraisal tests](Appraisals) using `bundle exec appraisal rake`.
|
|
1098
|
+
|
|
1099
|
+
You can run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
1100
|
+
|
|
1101
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
1091
1102
|
|
|
1092
|
-
To
|
|
1103
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
1093
1104
|
|
|
1094
1105
|
## Contributing
|
|
1095
1106
|
|
data/Rakefile
CHANGED
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'bundler/gem_tasks'
|
|
4
4
|
require 'rspec/core/rake_task'
|
|
5
|
-
require 'github_changelog_generator/task'
|
|
6
5
|
|
|
7
6
|
RSpec::Core::RakeTask.new(:spec)
|
|
8
7
|
|
|
9
8
|
task default: :spec
|
|
10
|
-
|
|
11
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
12
|
-
config.user = 'keypup-io'
|
|
13
|
-
config.project = 'cloudtasker'
|
|
14
|
-
end
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Cloudtasker
|
|
4
4
|
# Handle execution of workers
|
|
5
|
-
class WorkerController <
|
|
5
|
+
class WorkerController < ActionController::Base
|
|
6
|
+
# No need for CSRF verification on API endpoints
|
|
7
|
+
skip_before_action :verify_authenticity_token
|
|
8
|
+
|
|
6
9
|
# Authenticate all requests.
|
|
7
10
|
before_action :authenticate!
|
|
8
11
|
|
data/cloudtasker.gemspec
CHANGED
|
@@ -31,14 +31,13 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency 'activesupport'
|
|
32
32
|
spec.add_dependency 'connection_pool'
|
|
33
33
|
spec.add_dependency 'fugit'
|
|
34
|
-
spec.add_dependency 'google-cloud-tasks'
|
|
34
|
+
spec.add_dependency 'google-cloud-tasks'
|
|
35
35
|
spec.add_dependency 'jwt'
|
|
36
36
|
spec.add_dependency 'redis'
|
|
37
37
|
spec.add_dependency 'retriable'
|
|
38
38
|
|
|
39
39
|
spec.add_development_dependency 'appraisal'
|
|
40
40
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
41
|
-
spec.add_development_dependency 'github_changelog_generator'
|
|
42
41
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
|
43
42
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
44
43
|
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
|
|
@@ -47,8 +46,4 @@ Gem::Specification.new do |spec|
|
|
|
47
46
|
spec.add_development_dependency 'semantic_logger'
|
|
48
47
|
spec.add_development_dependency 'timecop'
|
|
49
48
|
spec.add_development_dependency 'webmock'
|
|
50
|
-
|
|
51
|
-
spec.add_development_dependency 'rails'
|
|
52
|
-
spec.add_development_dependency 'rspec-rails'
|
|
53
|
-
spec.add_development_dependency 'sqlite3'
|
|
54
49
|
end
|
data/docs/CRON_JOBS.md
CHANGED
|
@@ -65,3 +65,42 @@ if File.exist?(schedule_file) && !Rails.env.test?
|
|
|
65
65
|
end
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
## Limitations
|
|
69
|
+
GCP Cloud Tasks does not allow tasks to be scheduled more than 30 days (720h) in the future. Cron schedules should therefore be limited to 30 days intervals at most.
|
|
70
|
+
|
|
71
|
+
If you need to schedule a job to run on a monthly basis (e.g. on the first of the month), schedule this job to run every day then add the following logic in your job:
|
|
72
|
+
```ruby
|
|
73
|
+
#
|
|
74
|
+
# Cron schedule (8am UTC every day): 0 8 * * *
|
|
75
|
+
#
|
|
76
|
+
class MyMonthlyWorker
|
|
77
|
+
include Cloudtasker::Worker
|
|
78
|
+
|
|
79
|
+
def perform(*args)
|
|
80
|
+
# Abort unless we're the first of the month
|
|
81
|
+
return unless Time.current.day == 1
|
|
82
|
+
|
|
83
|
+
# ... job logic
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The same approach can be used to schedule a job every quarter.
|
|
89
|
+
```ruby
|
|
90
|
+
#
|
|
91
|
+
# Cron schedule (8am UTC every day): 0 8 * * *
|
|
92
|
+
#
|
|
93
|
+
class MyQuarterlyWorker
|
|
94
|
+
include Cloudtasker::Worker
|
|
95
|
+
|
|
96
|
+
def perform(*args)
|
|
97
|
+
# Abort unless we're the first month of a quarter (Jan, Apr, Jul, Oct)
|
|
98
|
+
return unless Time.current.month == 1
|
|
99
|
+
|
|
100
|
+
# Abort unless we're the first of the month
|
|
101
|
+
return unless Time.current.day == 1
|
|
102
|
+
|
|
103
|
+
# ... job logic
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
```
|
data/gemfiles/rails_5.2.gemfile
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED