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
| # request.port is unfortunately useless from within the app, as it | |
| # does not reflect the backend bind port, but the frontend proxy. | |
| # So we have to reverse lookup the PID to figure out our port. | |
| def backend_server_port | |
| Thread.current[:backend_server_port] ||= begin | |
| logger.debug "Attempting to reverse-lookup server port from PID file" | |
| port = nil | |
| Dir["#{RAILS_ROOT}/tmp/pids/thin.*.pid"].each do |f| | |
| pid = File.read(f).chomp.to_i | |
| if pid == $$ |