-
Notifications
You must be signed in to change notification settings - Fork 193
Link claimed_executions
to processes
via process_name
#601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rosa
wants to merge
11
commits into
main
Choose a base branch
from
claimed-executions-by-process-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cfa7c13
Add a deprecator to SolidQueue module
rosa b8efb15
Remove post-install message
rosa 46286cd
Add `update` generator and new migration
rosa 5351828
Apply update and new migration to Dummy app
rosa 6bdf56f
Reflect new migration on initial schema
rosa 698695a
Pass `process.name` all the way to claimed executions when claiming jobs
rosa 4b1af3a
Instruct Rubocop to ignore DB templates
rosa 0f3ab74
Guard usage of new `process_name` to link claimed executions
rosa aaea3cd
Add upgrade instructions to `UPGRADING`
rosa dfae79b
Include instructions to set a different DB for the migrations
rosa a06ef6b
Include `process_name` in relevant instrumentation events
rosa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -7,3 +7,4 @@ AllCops: | |
TargetRubyVersion: 3.3 | ||
Exclude: | ||
- "**/*_schema.rb" | ||
- "lib/generators/solid_queue/update/templates/db/*" |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
30 changes: 30 additions & 0 deletions
30
...rs/solid_queue/update/templates/db/link_claimed_executions_with_processes_through_name.rb
This file contains hidden or 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,30 @@ | ||
class LinkClaimedExecutionsWithProcessesThroughName < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>] | ||
def up | ||
unless connection.column_exists?(:solid_queue_claimed_executions, :process_name) | ||
add_column :solid_queue_claimed_executions, :process_name, :string | ||
add_index :solid_queue_claimed_executions, :process_name | ||
end | ||
|
||
unless connection.index_exists?(:solid_queue_processes, :name) | ||
add_index :solid_queue_processes, :name, unique: true | ||
end | ||
|
||
if connection.index_exists?(:solid_queue_processes, [ :name, :supervisor_id ]) | ||
remove_index :solid_queue_processes, [ :name, :supervisor_id ] | ||
end | ||
end | ||
|
||
def down | ||
if connection.column_exists?(:solid_queue_claimed_executions, :process_name) | ||
remove_column :solid_queue_claimed_executions, :process_name | ||
end | ||
|
||
if connection.index_exists?(:solid_queue_processes, :name) | ||
remove_index :solid_queue_processes, :name | ||
end | ||
|
||
unless connection.index_exists?(:solid_queue_processes, [ :name, :supervisor_id ]) | ||
add_index :solid_queue_processes, [ :name, :supervisor_id ], unique: true | ||
end | ||
end | ||
end |
This file contains hidden or 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,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails/generators/active_record" | ||
|
||
class SolidQueue::UpdateGenerator < Rails::Generators::Base | ||
include ActiveRecord::Generators::Migration | ||
|
||
source_root File.expand_path("templates", __dir__) | ||
|
||
class_option :database, type: :string, aliases: %i[ --db ], default: "queue", | ||
desc: "The database that Solid Queue uses. Defaults to `queue`" | ||
|
||
def copy_new_migrations | ||
template_dir = Dir.new(File.join(self.class.source_root, "db")) | ||
|
||
template_dir.each_child do |migration_file| | ||
migration_template File.join("db", migration_file), File.join(db_migrate_path, migration_file), skip: true | ||
end | ||
end | ||
end |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
module SolidQueue | ||
VERSION = "1.2.0" | ||
|
||
def self.next_major_version | ||
Gem::Version.new(VERSION).segments.first + 1 | ||
end | ||
end |
This file contains hidden or 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 hidden or 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
30 changes: 30 additions & 0 deletions
30
...my/db/queue_migrate/20250720172253_link_claimed_executions_with_processes_through_name.rb
This file contains hidden or 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,30 @@ | ||
class LinkClaimedExecutionsWithProcessesThroughName < ActiveRecord::Migration[7.1] | ||
def up | ||
unless connection.column_exists?(:solid_queue_claimed_executions, :process_name) | ||
add_column :solid_queue_claimed_executions, :process_name, :string | ||
add_index :solid_queue_claimed_executions, :process_name | ||
end | ||
|
||
unless connection.index_exists?(:solid_queue_processes, :name) | ||
add_index :solid_queue_processes, :name, unique: true | ||
end | ||
|
||
if connection.index_exists?(:solid_queue_processes, [ :name, :supervisor_id ]) | ||
remove_index :solid_queue_processes, [ :name, :supervisor_id ] | ||
end | ||
end | ||
|
||
def down | ||
if connection.column_exists?(:solid_queue_claimed_executions, :process_name) | ||
remove_column :solid_queue_claimed_executions, :process_name | ||
end | ||
|
||
if connection.index_exists?(:solid_queue_processes, :name) | ||
remove_index :solid_queue_processes, :name | ||
end | ||
|
||
unless connection.index_exists?(:solid_queue_processes, [ :name, :supervisor_id ]) | ||
add_index :solid_queue_processes, [ :name, :supervisor_id ], unique: true | ||
end | ||
end | ||
end |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration is idempotent because it is already included in the setup schema, for people who are installing Solid Queue for the first time. If there's a new update in the future with a new migration, people should be able to run all of them without any issues.