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

Lock expiration does not work on Single Table Inheritance objects. #203

Open
jdejong opened this issue Nov 4, 2016 · 2 comments
Open

Lock expiration does not work on Single Table Inheritance objects. #203

jdejong opened this issue Nov 4, 2016 · 2 comments

Comments

@jdejong
Copy link

jdejong commented Nov 4, 2016

Imagine a base class called service

class Service < ActiveRecord::Base
  include Redis::Objects
  lock :mylock, :expiration => 15.minutes, :timeout => 10.seconds 
end

And two subclasses Service 1

class Service1 < Service

end

and Service 2

class Service2 < Service

end

Now you can call

Service.first.mylock_lock.lock.do
   sleep 60
end

and when you check the redis lock object you will see a 1 instead of a timestamp. Any idea why this is not working as expected?

Thanks!

@nateware
Copy link
Owner

Sorry for my delay. Can you see if manually overriding the redis_prefix works?

class Service2 < Service
  self.redis_prefix = 'service2'
end

@nateware
Copy link
Owner

CC @tmsrjs seems like this one may either be a complex issue, or not a bug at all.

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

2 participants