Closed mdpye closed 10 years ago
We already require this for all the lua scripts in pusher-server. I wrote a setex version, but it's phenomenally complicated in comparison and I still knew of at least one failure case.
They even note that the setex pattern is crop in it's own documentation...
I was confusing SETEX and SETNX. SETEX is the same technique with better backwards compatibility, SETNX is the old algorithm.
Looks good, but I think it would be useful to have specs for the persistent lock.
Agreed, I'm not dead clear on the best way to write them though. I'd like to write a true unit test by mocking both the lock and the timers. I'll have a go.
Any chance the improved locking version will be released as an updated gem soon? I have a separate project where I implemented the LUA-based locking and its great, and rather than perpetuate that code, I would much rather use the better locking you guys have developed here. Persistence locking is exactly what my new project needs!
@machadolab yes, looks like a release is due - I'll try to get one out soon.
@machadolab I just released 0.3.0
Re-implemented Lock using lua scripting to provide a considerably simpler and safer mechanism for locking.
Also add some tests to the locking implementation.
Let's get lua_support merged and released as well!