Skip to content
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

Don't add solid_queue.connects_to configuration more than once #439

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/generators/solid_queue/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ def copy_files
chmod "bin/jobs", 0755 & ~File.umask, verbose: false
end

def configure_active_job_adapter
gsub_file Pathname(destination_root).join("config/environments/production.rb"),
/(# )?config\.active_job\.queue_adapter\s+=.*/,
def configure_adapter_and_database
pathname = Pathname(destination_root).join("config/environments/production.rb")

gsub_file pathname, /\n\s*config\.solid_queue\.connects_to\s+=.*\n/, "\n", verbose: false
gsub_file pathname, /(# )?config\.active_job\.queue_adapter\s+=.*\n/,
"config.active_job.queue_adapter = :solid_queue\n" +
" config.solid_queue.connects_to = { database: { writing: :queue } }\n"
end
Expand Down
Loading