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

Caller context key strategy totally borks if Garner::Cache::Context#garner is monkey-patched #56

Open
fancyremarker opened this issue Sep 6, 2013 · 3 comments

Comments

@fancyremarker
Copy link
Contributor

Let's say I do the following

# config/initializers/garner.rb

module Garner
  module Mixins
    module Rack

      alias_method :_garner, :garner
      def garner(&block)
        response, headers = _garner.key({ foo: "bar" }, &block)
      end
    end
  end
end

Now the calling line number will always be config/initializers/garner.rb:9, instead of where the method was originally called from.

Can we be smarter about this?

@dblock
Copy link
Contributor

dblock commented Sep 6, 2013

Possibly by examining class names on the stack instead of file names?

@monfresh
Copy link

Is this related to issue #54 ? Is that monkey patch not safe to use in production? It seems to be working fine for me.

@fancyremarker
Copy link
Contributor Author

@monfresh This is unrelated; the patch from #54 is safe since it patches fetch, not garner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants