-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependencies: GoodJob v3.99.1 (#702)
* chore: update good_jobs to v3.99.1 to prepare for 4.X upgrade * chore: add in missing jobs schema file * chore: fix rubocop violations in migrations * chore: attempt to fix some flaky tests
- Loading branch information
Showing
9 changed files
with
97 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
db/jobs_migrate/20240814150153_create_good_job_process_lock_ids.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
# Migration to add process lock ids | ||
class CreateGoodJobProcessLockIds < ActiveRecord::Migration[7.1] | ||
def change | ||
reversible do |dir| | ||
dir.up do | ||
# Ensure this incremental update migration is idempotent | ||
# with monolithic install migration. | ||
return if connection.column_exists?(:good_jobs, :locked_by_id) | ||
end | ||
end | ||
|
||
add_column :good_jobs, :locked_by_id, :uuid # rubocop:disable Rails/BulkChangeTable | ||
add_column :good_jobs, :locked_at, :datetime | ||
add_column :good_job_executions, :process_id, :uuid | ||
add_column :good_job_processes, :lock_type, :integer, limit: 2 | ||
end | ||
end |
46 changes: 46 additions & 0 deletions
46
db/jobs_migrate/20240814150154_create_good_job_process_lock_indexes.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
# Migration to create good job process lock indexes | ||
class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.1] | ||
disable_ddl_transaction! | ||
|
||
def change # rubocop:disable Metrics/AbcSize,Metrics/MethodLength | ||
reversible do |dir| # rubocop:disable Metrics/BlockLength | ||
dir.up do | ||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) | ||
add_index :good_jobs, %i[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, | ||
algorithm: :concurrently | ||
end | ||
|
||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_locked_by_id) | ||
add_index :good_jobs, :locked_by_id, | ||
where: 'locked_by_id IS NOT NULL', | ||
name: :index_good_jobs_on_locked_by_id, | ||
algorithm: :concurrently | ||
end | ||
|
||
unless connection.index_name_exists?(:good_job_executions, | ||
:index_good_job_executions_on_process_id_and_created_at) | ||
add_index :good_job_executions, %i[process_id created_at], | ||
name: :index_good_job_executions_on_process_id_and_created_at, | ||
algorithm: :concurrently | ||
end | ||
end | ||
|
||
dir.down do | ||
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) | ||
remove_index(:good_jobs, name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) | ||
end | ||
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_locked_by_id) | ||
remove_index(:good_jobs, name: :index_good_jobs_on_locked_by_id) | ||
end | ||
if connection.index_name_exists?(:good_job_executions, :index_good_job_executions_on_process_id_and_created_at) | ||
remove_index(:good_job_executions, name: :index_good_job_executions_on_process_id_and_created_at) | ||
end | ||
end | ||
end | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
db/jobs_migrate/20240814150155_create_good_job_execution_duration.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
# Migration to create good job execution duration column | ||
class CreateGoodJobExecutionDuration < ActiveRecord::Migration[7.1] | ||
def change | ||
reversible do |dir| | ||
dir.up do | ||
# Ensure this incremental update migration is idempotent | ||
# with monolithic install migration. | ||
return if connection.column_exists?(:good_job_executions, :duration) | ||
end | ||
end | ||
|
||
add_column :good_job_executions, :duration, :interval | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters