Skip to content

Commit

Permalink
fix: lock GoodJob dependency to < 4.0 (#211)
Browse files Browse the repository at this point in the history
GoodJob v4 was recently released, but that has some breaking changes
that don't work well with Judoscale yet. Before adding full support to
the new version, we're doing a patch release to lock it to version < 4,
so that people trying to install both don't run into problems using
GoodJob v4 and Judoscale.

https://island94.org/2024/07/introducing-goodjob-v4
  • Loading branch information
carlosantoniodasilva committed Jul 8, 2024
1 parent dd0c08c commit d558584
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 71 deletions.
2 changes: 1 addition & 1 deletion judoscale-good_job/judoscale-good_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = ">= 2.6.0"

spec.add_dependency "judoscale-ruby", Judoscale::VERSION
spec.add_dependency "good_job", ">= 3.0"
spec.add_dependency "good_job", ">= 3.0", "< 4.0"
end
10 changes: 10 additions & 0 deletions judoscale-good_job/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class TestRailsApp < Rails::Application
t.text :job_class
t.integer :error_event, limit: 2
t.text :labels, array: true
t.uuid :locked_by_id
t.datetime :locked_at
end

create_table :good_job_batches, id: :uuid do |t|
Expand Down Expand Up @@ -94,11 +96,14 @@ class TestRailsApp < Rails::Application
t.text :error
t.integer :error_event, limit: 2
t.text :error_backtrace, array: true
t.uuid :process_id
t.interval :duration
end

create_table :good_job_processes, id: :uuid do |t|
t.timestamps
t.jsonb :state
t.integer :lock_type, limit: 2
end

create_table :good_job_settings, id: :uuid do |t|
Expand All @@ -124,6 +129,11 @@ class TestRailsApp < Rails::Application
add_index :good_jobs, :labels, using: :gin, where: "(labels IS NOT NULL)", name: :index_good_jobs_on_labels

add_index :good_job_executions, [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
add_index :good_jobs, [:priority, :scheduled_at], order: { priority: "ASC NULLS LAST", scheduled_at: :asc },
where: "finished_at IS NULL AND locked_by_id IS NULL", name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked
add_index :good_jobs, :locked_by_id,
where: "locked_by_id IS NOT NULL", name: "index_good_jobs_on_locked_by_id"
add_index :good_job_executions, [:process_id, :created_at], name: :index_good_job_executions_on_process_id_and_created_at
end
# standard:enable all
end
Expand Down
68 changes: 34 additions & 34 deletions sample-apps/good_job-multi-db-sample/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
PATH
remote: ../../judoscale-good_job
specs:
judoscale-good_job (1.6.0)
good_job (>= 3.0)
judoscale-ruby (= 1.6.0)
judoscale-good_job (1.7.0)
good_job (>= 3.0, < 4.0)
judoscale-ruby (= 1.7.0)

PATH
remote: ../../judoscale-rails
specs:
judoscale-rails (1.6.0)
judoscale-ruby (= 1.6.0)
judoscale-rails (1.7.0)
judoscale-ruby (= 1.7.0)
railties

PATH
remote: ../../judoscale-ruby
specs:
judoscale-ruby (1.6.0)
judoscale-ruby (1.7.0)

GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionpack (7.0.8.4)
actionview (= 7.0.8.4)
activesupport (= 7.0.8.4)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
actionview (7.0.8.4)
activesupport (= 7.0.8.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
activejob (7.0.8.4)
activesupport (= 7.0.8.4)
globalid (>= 0.3.6)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activesupport (7.0.8.1)
activemodel (7.0.8.4)
activesupport (= 7.0.8.4)
activerecord (7.0.8.4)
activemodel (= 7.0.8.4)
activesupport (= 7.0.8.4)
activesupport (7.0.8.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
builder (3.2.4)
concurrent-ruby (1.2.3)
builder (3.3.0)
concurrent-ruby (1.3.3)
crass (1.0.6)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
erubi (1.12.0)
erubi (1.13.0)
et-orbi (1.2.11)
tzinfo
fugit (1.11.0)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
good_job (3.28.2)
good_job (3.99.0)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
concurrent-ruby (>= 1.0.2)
fugit (>= 1.1)
railties (>= 6.0.0)
thor (>= 0.14.1)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.12.0)
Expand All @@ -77,21 +77,21 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
method_source (1.1.0)
minitest (5.22.3)
minitest (5.24.1)
nio4r (2.7.1)
nokogiri (1.16.4-arm64-darwin)
nokogiri (1.16.6-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-darwin)
nokogiri (1.16.6-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
pg (1.5.6)
psych (5.1.2)
stringio
puma (5.6.8)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.7.3)
racc (1.8.0)
rack (2.2.9)
rack-test (2.1.0)
rack (>= 1.3)
Expand All @@ -102,9 +102,9 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
railties (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand All @@ -118,7 +118,7 @@ GEM
thor (1.3.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
zeitwerk (2.6.13)
zeitwerk (2.6.16)

PLATFORMS
arm64-darwin-20
Expand All @@ -144,4 +144,4 @@ DEPENDENCIES
railties (~> 7.0.1)

BUNDLED WITH
2.5.4
2.5.11
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def change
t.text :job_class
t.integer :error_event, limit: 2
t.text :labels, array: true
t.uuid :locked_by_id
t.datetime :locked_at
end

create_table :good_job_batches, id: :uuid do |t|
Expand Down Expand Up @@ -58,11 +60,14 @@ def change
t.text :error
t.integer :error_event, limit: 2
t.text :error_backtrace, array: true
t.uuid :process_id
t.interval :duration
end

create_table :good_job_processes, id: :uuid do |t|
t.timestamps
t.jsonb :state
t.integer :lock_type, limit: 2
end

create_table :good_job_settings, id: :uuid do |t|
Expand All @@ -88,5 +93,10 @@ def change
add_index :good_jobs, :labels, using: :gin, where: "(labels IS NOT NULL)", name: :index_good_jobs_on_labels

add_index :good_job_executions, [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
add_index :good_jobs, [:priority, :scheduled_at], order: { priority: "ASC NULLS LAST", scheduled_at: :asc },
where: "finished_at IS NULL AND locked_by_id IS NULL", name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked
add_index :good_jobs, :locked_by_id,
where: "locked_by_id IS NOT NULL", name: "index_good_jobs_on_locked_by_id"
add_index :good_job_executions, [:process_id, :created_at], name: :index_good_job_executions_on_process_id_and_created_at
end
end
10 changes: 9 additions & 1 deletion sample-apps/good_job-multi-db-sample/db/good_job_db_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_04_30_131249) do
ActiveRecord::Schema[7.0].define(version: 2024_07_08_144259) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "timescaledb"
Expand Down Expand Up @@ -43,13 +43,17 @@
t.text "error"
t.integer "error_event", limit: 2
t.text "error_backtrace", array: true
t.uuid "process_id"
t.interval "duration"
t.index ["active_job_id", "created_at"], name: "index_good_job_executions_on_active_job_id_and_created_at"
t.index ["process_id", "created_at"], name: "index_good_job_executions_on_process_id_and_created_at"
end

create_table "good_job_processes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.jsonb "state"
t.integer "lock_type", limit: 2
end

create_table "good_job_settings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
Expand Down Expand Up @@ -82,6 +86,8 @@
t.text "job_class"
t.integer "error_event", limit: 2
t.text "labels", array: true
t.uuid "locked_by_id"
t.datetime "locked_at"
t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at"
t.index ["batch_callback_id"], name: "index_good_jobs_on_batch_callback_id", where: "(batch_callback_id IS NOT NULL)"
t.index ["batch_id"], name: "index_good_jobs_on_batch_id", where: "(batch_id IS NOT NULL)"
Expand All @@ -90,8 +96,10 @@
t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at_cond", unique: true, where: "(cron_key IS NOT NULL)"
t.index ["finished_at"], name: "index_good_jobs_jobs_on_finished_at", where: "((retried_good_job_id IS NULL) AND (finished_at IS NOT NULL))"
t.index ["labels"], name: "index_good_jobs_on_labels", where: "(labels IS NOT NULL)", using: :gin
t.index ["locked_by_id"], name: "index_good_jobs_on_locked_by_id", where: "(locked_by_id IS NOT NULL)"
t.index ["priority", "created_at"], name: "index_good_job_jobs_for_candidate_lookup", where: "(finished_at IS NULL)"
t.index ["priority", "created_at"], name: "index_good_jobs_jobs_on_priority_created_at_when_unfinished", order: { priority: "DESC NULLS LAST" }, where: "(finished_at IS NULL)"
t.index ["priority", "scheduled_at"], name: "index_good_jobs_on_priority_scheduled_at_unfinished_unlocked", where: "((finished_at IS NULL) AND (locked_by_id IS NULL))"
t.index ["queue_name", "scheduled_at"], name: "index_good_jobs_on_queue_name_and_scheduled_at", where: "(finished_at IS NULL)"
t.index ["scheduled_at"], name: "index_good_jobs_on_scheduled_at", where: "(finished_at IS NULL)"
end
Expand Down
Loading

0 comments on commit d558584

Please sign in to comment.