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

Refactor StoreProxy to avoid autoloading MemCacheStore #165

Merged
merged 2 commits into from
Feb 17, 2016

Conversation

ktheory
Copy link
Collaborator

@ktheory ktheory commented Feb 16, 2016

In v4.4.0, checking defined?(ActiveSupport::Cache::MemCacheStore)
could trigger an error loading dalli, which isn’t needed.

This fixes that bug, and prevents similar bugs by checking
store.class.to_s rather than defined?(klass) && store.is_a?(klass).

Writing an automated test to ensure that dalli is truly optional is
difficult, but I was able to recreate the dalli load error in v4.4.0 by
running:

gem uninstall dalli
ruby -Ilib -ractive_support/all -ractive_support/cache/redis_store -rrack/attack -e 'p Rack::Attack::StoreProxy.build(Redis::Store.new)'

Fixes #163

In v4.4.0, checking `defined?(ActiveSupport::Cache::MemCacheStore)`
could trigger an error loading dalli, which isn’t needed.

This fixes that bug, and prevents similar bugs by checking
`store.class.to_s` rather than `defined?(klass) && store.is_a?(klass)`.

Writing an automated test to ensure that dalli is truly optional is
difficult, but I was able to recreate the dalli load error in v4.4.0 by
running:

    gem uninstall dalli
    ruby -Ilib -ractive_support/all -ractive_support/cache/redis_store
-rrack/attack -e 'p Rack::Attack::StoreProxy.build(Redis::Store.new)'

Fixes #163
ktheory added a commit that referenced this pull request Feb 17, 2016
Refactor StoreProxy to avoid autoloading MemCacheStore
@ktheory ktheory merged commit 63ee779 into master Feb 17, 2016
@ktheory ktheory deleted the fix-dalli-dependency branch February 17, 2016 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specs fail following upgrade from 4.3.1 to 4.4.0
1 participant