good_job 1.99.0 → 1.99.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
  SHA256:
3
- metadata.gz: fe59c2b49eaef9a76ecbf1af80c6ea765fb89a5d61f01b0436595e15e377019e
4
- data.tar.gz: 15c0ee082903f8316de7656e855489492a00e90b3e75e55475f59824b49c0542
3
+ metadata.gz: 97662bae9e8ba65e5ed3e9ba52b8b987d77974866885a548a8a3b13878045c7a
4
+ data.tar.gz: 415d36696796cfb4c0ff1737c7c75e2b66bbfceea15f3a90aba55b49ee5da715
5
5
  SHA512:
6
- metadata.gz: 22c7de0952050994cb220cda916ce85187775d2b79692b8ee094a0e6e76f84945ad528327fc3e83e50263e46272094949d2d6270a0332c19e8f79fb0841e0d80
7
- data.tar.gz: '0229a23385ed171a50a39d54ab5295a5147110d203e84518643caa49c2dab16eee16263b54c86245a376e946402e9d39d52f05c3cde6ba2906f8f32fd77046e0'
6
+ metadata.gz: 2d293eabb7b926386b30a1348c529de6a2252c1c734b7a92a81abad2fdd791a28abe5067850c9a4f7595182afd72d52eccc0c640d7596aaddcba467a995449ca
7
+ data.tar.gz: 4b981bda934dc7e58aab80bd998c16b9c8261309cf8f5ffce09253c45821f0106ef0db0249934a3649e735715d865ff6dd62232876afb7ffca76cfb4fe473179
data/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.99.1](https://github.com/bensheldon/good_job/tree/v1.99.1) (2021-08-27)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.0.1...v1.99.1)
6
+
7
+ **Closed issues:**
8
+
9
+ - Does Good job support delay method? [\#344](https://github.com/bensheldon/good_job/issues/344)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - README style/typo fixes: "web server" and possessive "Rails'" [\#350](https://github.com/bensheldon/good_job/pull/350) ([aried3r](https://github.com/aried3r))
14
+ - Add examples of setting config.good\_job.queues [\#349](https://github.com/bensheldon/good_job/pull/349) ([zachmargolis](https://github.com/zachmargolis))
15
+
16
+ ## [v2.0.1](https://github.com/bensheldon/good_job/tree/v2.0.1) (2021-08-24)
17
+
18
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.0.0...v2.0.1)
19
+
20
+ **Implemented enhancements:**
21
+
22
+ - Suppress backtrace of ConcurrencyExceededError [\#348](https://github.com/bensheldon/good_job/pull/348) ([reczy](https://github.com/reczy))
23
+
24
+ **Closed issues:**
25
+
26
+ - Is there any value in seeing a backtrace for ConcurrencyExceededError? [\#347](https://github.com/bensheldon/good_job/issues/347)
27
+ - Release GoodJob 2.0 [\#307](https://github.com/bensheldon/good_job/issues/307)
28
+ - Unhandled ActiveJob errors should trigger GoodJob.on\_thread\_error [\#247](https://github.com/bensheldon/good_job/issues/247)
29
+
30
+ ## [v2.0.0](https://github.com/bensheldon/good_job/tree/v2.0.0) (2021-08-24)
31
+
32
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.99.0...v2.0.0)
33
+
34
+ **Implemented enhancements:**
35
+
36
+ - Concurrency's enqueue\_limit should exclude performing jobs from count [\#317](https://github.com/bensheldon/good_job/issues/317)
37
+ - Rename `:async` to `:async_all`; `:async_server` to `:async` and set as Development environment default; do not poll in async development [\#343](https://github.com/bensheldon/good_job/pull/343) ([bensheldon](https://github.com/bensheldon))
38
+ - Exclude executing jobs from Concurrency's enqueue\_limit's count [\#342](https://github.com/bensheldon/good_job/pull/342) ([bensheldon](https://github.com/bensheldon))
39
+ - Unhandled ActiveJob errors should trigger GoodJob.on\_thread\_error [\#312](https://github.com/bensheldon/good_job/pull/312) ([bensheldon](https://github.com/bensheldon))
40
+
41
+ **Closed issues:**
42
+
43
+ - Swap behavior of `async` with `async_server`; rename `async` execution mode to be `async_all`; default `async` in Development; [\#340](https://github.com/bensheldon/good_job/issues/340)
44
+ - Add hyphen to lock key. e.g. "\[table\_name\]-\[column\]" instead of "\[table\_name\]\[column\]" [\#335](https://github.com/bensheldon/good_job/issues/335)
45
+ - Use `async_server` as default execution mode in Development environment [\#139](https://github.com/bensheldon/good_job/issues/139)
46
+
47
+ **Merged pull requests:**
48
+
49
+ - Remove v1.0 deprecation notices and incremental migrations [\#338](https://github.com/bensheldon/good_job/pull/338) ([bensheldon](https://github.com/bensheldon))
50
+ - Lock GoodJob::Job on active\_job\_id instead of the row id; adds separator hyphen to lock key [\#337](https://github.com/bensheldon/good_job/pull/337) ([bensheldon](https://github.com/bensheldon))
51
+
3
52
  ## [v1.99.0](https://github.com/bensheldon/good_job/tree/v1.99.0) (2021-08-24)
4
53
 
5
54
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.13.2...v1.99.0)
data/README.md CHANGED
@@ -86,6 +86,13 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
86
86
  $ bin/rails db:migrate
87
87
  ```
88
88
 
89
+ Optional: If using Rails' multiple databases with the `migrations_paths` configuration option, use the `--database` option:
90
+
91
+ ```bash
92
+ bin/rails g good_job:install --database animals
93
+ bin/rails db:migrate:animals
94
+ ```
95
+
89
96
  1. Configure the ActiveJob adapter:
90
97
 
91
98
  ```ruby
@@ -419,6 +426,12 @@ To perform upgrades to the GoodJob database tables:
419
426
  bin/rails g good_job:update
420
427
  ```
421
428
 
429
+ Optional: If using Rails' multiple databases with the `migrations_paths` configuration option, use the `--database` option:
430
+
431
+ ```bash
432
+ $ bin/rails g good_job:update --database animals
433
+ ```
434
+
422
435
  1. Run the database migration locally
423
436
 
424
437
  ```bash
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rails/generators'
3
3
  require 'rails/generators/active_record'
4
+
4
5
  module GoodJob
5
6
  #
6
7
  # Rails generator used for setting up GoodJob in a Rails application.
7
8
  # Run it with +bin/rails g good_job:install+ in your console.
8
9
  #
9
10
  class InstallGenerator < Rails::Generators::Base
10
- include Rails::Generators::Migration
11
+ include ActiveRecord::Generators::Migration
11
12
 
12
- class << self
13
- delegate :next_migration_number, to: ActiveRecord::Generators::Base
14
- end
13
+ TEMPLATES = File.join(File.dirname(__FILE__), "templates/install")
14
+ source_paths << TEMPLATES
15
15
 
16
- source_paths << File.join(File.dirname(__FILE__), "templates/install")
16
+ class_option :database, type: :string, aliases: %i(--db), desc: "The database for your migration. By default, the current environment's primary database is used."
17
17
 
18
18
  # Generates monolithic migration file that contains all database changes.
19
19
  def create_migration_file
20
- migration_template 'migrations/create_good_jobs.rb.erb', 'db/migrate/create_good_jobs.rb'
20
+ migration_template 'migrations/create_good_jobs.rb.erb', File.join(db_migrate_path, "create_good_jobs.rb")
21
21
  end
22
22
  end
23
23
  end
@@ -4,10 +4,6 @@ class AddActiveJobIdIndexAndConcurrencyKeyIndexToGoodJobs < ActiveRecord::Migrat
4
4
 
5
5
  UPDATE_BATCH_SIZE = 1_000
6
6
 
7
- class GoodJobJobs < ActiveRecord::Base
8
- self.table_name = "good_jobs"
9
- end
10
-
11
7
  def change
12
8
  reversible do |dir|
13
9
  dir.up do
@@ -21,11 +17,14 @@ class AddActiveJobIdIndexAndConcurrencyKeyIndexToGoodJobs < ActiveRecord::Migrat
21
17
  add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", algorithm: :concurrently, name: :index_good_jobs_on_concurrency_key_when_unfinished
22
18
  add_index :good_jobs, [:cron_key, :created_at], algorithm: :concurrently, name: :index_good_jobs_on_cron_key_and_created_at
23
19
 
20
+ return unless defined? GoodJob::Job
21
+
24
22
  reversible do |dir|
25
23
  dir.up do
24
+ # Ensure that all `good_jobs` records have an active_job_id value
26
25
  start_time = Time.current
27
26
  loop do
28
- break if GoodJobJobs.where(active_job_id: nil, finished_at: nil).where("created_at < ?", start_time).limit(UPDATE_BATCH_SIZE).update_all("active_job_id = (serialized_params->>'job_id')::uuid").zero?
27
+ break if GoodJob::Job.where(active_job_id: nil, finished_at: nil).where("created_at < ?", start_time).limit(UPDATE_BATCH_SIZE).update_all("active_job_id = (serialized_params->>'job_id')::uuid").zero?
29
28
  end
30
29
  end
31
30
  end
@@ -8,22 +8,20 @@ module GoodJob
8
8
  # Run it with +bin/rails g good_job:update+ in your console.
9
9
  #
10
10
  class UpdateGenerator < Rails::Generators::Base
11
- include Rails::Generators::Migration
12
-
13
- class << self
14
- delegate :next_migration_number, to: ActiveRecord::Generators::Base
15
- end
11
+ include ActiveRecord::Generators::Migration
16
12
 
17
13
  TEMPLATES = File.join(File.dirname(__FILE__), "templates/update")
18
14
  source_paths << TEMPLATES
19
15
 
16
+ class_option :database, type: :string, aliases: %i(--db), desc: "The database for your migration. By default, the current environment's primary database is used."
17
+
20
18
  # Generates incremental migration files unless they already exist.
21
19
  # All migrations should be idempotent e.g. +add_index+ is guarded with +if_index_exists?+
22
20
  def update_migration_files
23
21
  migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort
24
22
  migration_templates.each do |template_file|
25
23
  destination_file = template_file.match(/^\d*_(.*\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb
26
- migration_template "migrations/#{template_file}", "db/migrate/#{destination_file}", skip: true
24
+ migration_template "migrations/#{template_file}", File.join(db_migrate_path, destination_file), skip: true
27
25
  end
28
26
  end
29
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '1.99.0'
4
+ VERSION = '1.99.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.0
4
+ version: 1.99.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-24 00:00:00.000000000 Z
11
+ date: 2021-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob