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

fix update phased restart symlink folder #3295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/puma/launcher.rb
Expand Up @@ -165,6 +165,13 @@ def phased_restart
log "* phased-restart called but not available, restarting normally."
return restart
end

if @options.file_options[:tag].nil?
dir = File.realdirpath(@restart_dir)
@options[:tag] = File.basename(dir)
set_process_title
end

true
end

Expand Down
9 changes: 9 additions & 0 deletions test/test_worker_gem_independence.rb
Expand Up @@ -112,10 +112,13 @@ def change_gem_version_during_phased_restart(old_app_dir:,
silent_and_checked_system_command("bundle install")
end
end

verify_process_tag(@server.pid, File.basename(old_app_dir))
start_phased_restart

connection = connect
new_reply = read_body(connection)
verify_process_tag(@server.pid, File.basename(new_app_dir))
assert_equal new_version, new_reply
end

Expand All @@ -142,4 +145,10 @@ def with_unbundled_env
Bundler.with_unbundled_env { yield }
end
end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dentarg

Added testcases in TestWorkerGemIndependence. not sure if it should be in separate or new class.

also used grep here as I did not find any alternative to get the title of Process running. we are using setproctitle to set the title but there is no equivalent to this for get.

def verify_process_tag(pid, tag)
cmd = "ps aux | grep #{pid}"
io = IO.popen cmd, 'r'
assert io.read.include? tag
end
end