-
Notifications
You must be signed in to change notification settings - Fork 170
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
Proxied control methods generated do not respect arity #354
Comments
I have forked the repo and will be offering a PR for consideration on the above issue. |
Stack trace from deadlock situation for the record:
|
This comment was marked as spam.
This comment was marked as spam.
Hi @tjchambers , do you have workaround to solve this on? |
Apologies, but this was done on a client project and I do not have the final code. But I believe this reflects the change to the # Control methods must always be passed to the
# Makara::Proxy control object for handling (typically
# related to ActiveRecord connection pool management)
@proxy.class.control_methods.each do |meth|
method_call = RUBY_VERSION >= "3.0.0" ? "public_send(#{meth.inspect}, ...)" : "#{meth}(*args=args, block)"
method_call2 = if meth.to_s.end_with?("=") && !meth.to_s.end_with?("==")
method_call
else
method_call.dup.sub("block","&block")
end
extension << <<~RUBY
def #{meth}(#{args})
proxy = _makara
if proxy
proxy.control.#{method_call2}
else
super # Only if we are not wrapped any longer
end
end
RUBY
end |
Obviously I failed to live up to my commitment to offer a PR, and without a set of specs it would be difficult to prove this is the best fix. However if you find this works and would offer a PR for the community I for one would appreciate it. |
The metaprogrammed control methods generated by this gem are not all generated respecting the arity of the replaced method. An example in Rails 6.1.5 is that
connection.owner
has no arguments, but the generated methods pass an argumentblock
and therefore fail withThe code path experienced occurred during a Mysql2 Deadlock situation.
AFAICT there are no specs for the generated methods proving that they are callable.
The text was updated successfully, but these errors were encountered: