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

refs #22792 いこーよ: リードレプリカの CPU 使用率を上げる #1

Merged
merged 1 commit into from Apr 27, 2016
Merged
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
Expand Up @@ -140,7 +140,6 @@ def #{method_name}(*args, &block)
klass.class_eval <<-EOS, __FILE__, __LINE__ + 1
def #{method_name}(*args, &block)
connection = @use_master ? master_connection : current_read_connection
::Rails.logger.debug(connection.spd_connection_name)
proxy_connection_method(connection, :#{method_name}, :read, *args, &block)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

うざいのやめ

end
EOS
Expand Down
10 changes: 5 additions & 5 deletions lib/seamless_database_pool/controller_filter.rb
Expand Up @@ -66,7 +66,7 @@ def use_database_pool(options)
# a master connection block. It is made available just in case you have special needs that don't quite fit
# into this module's default logic.
def use_master_db_connection_on_next_request
#session[:next_request_db_connection] = :master if session
session[:next_request_db_connection] = :master if session
end

def seamless_database_pool_options
Expand Down Expand Up @@ -99,10 +99,10 @@ def perform_action_with_seamless_database_pool(*args)
# Set the read only connection for a block. Used to set the connection for a controller action.
def set_read_only_connection_for_block(action)
read_pool_method = nil
#if session
# read_pool_method = session[:next_request_db_connection]
# session[:next_request_db_connection] = nil
#end
if session
read_pool_method = session[:next_request_db_connection]
session.delete(:next_request_db_connection) if session[:next_request_db_connection]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

end

read_pool_method ||= seamless_database_pool_options[action.to_sym] || seamless_database_pool_options[:all]
if read_pool_method
Expand Down