redis-objects icon indicating copy to clipboard operation
redis-objects copied to clipboard

Lock expiration does not work on Single Table Inheritance objects.

Open jdejong opened this issue 8 years ago • 2 comments

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!

jdejong avatar Nov 04 '16 14:11 jdejong

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

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

nateware avatar Mar 11 '17 19:03 nateware

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

nateware avatar Nov 16 '19 04:11 nateware