Rakesh what? No, sorry I didn't mean to sound like that. Open source is meant to exchange ideas and move forward, stuff aren't always obvious to everyone and I love when people point out things in my code so I can improve!
Cheers! 2012/6/19 Rakesh Pai <[email protected]>: > Thanks George, > > I feel like a dumbass now, for the API I've provided - your > suggestions are awesome. I'll push a commit soon to incorporate your > suggestions. > > Thanks, > Rakesh Pai > > On Tue, Jun 19, 2012 at 10:55 AM, George Stagas <[email protected]> wrote: >> Pretty nice! It's similar to my https://github.com/stagas/atomic but >> mine's only in-process. One way you could simplify the API further is >> to pass the client once and return a function: lock = >> require('redis-lock')(client); lock('foo', fn); >> I also found it's convenient to pass the lock key and extra arguments >> to the callback, to save you a closure in a for/while loop. >> >> -stagas >> >> 2012/6/19 Rakesh Pai <[email protected]>: >>> I put this up on github a couple of days ago: >>> https://github.com/errorception/redis-lock >>> >>> It's an implementation of a locking primitive using redis. It's great >>> for when you want to ensure that you don't run into concurrency issues >>> when using the node event loop heavily, or with multiple instances of >>> node. It doesn't block the event loop at all, yet ensures that your >>> functions execute in order (across processes), to ensure integrity. >>> it's kinda niche, but when you need it you need it badly. I've been >>> using this myself on http://errorception.com kinda heavily, and it >>> seems to do the job very well. I've tried hard to keep the API real >>> simple - just one function call! Depends on Redis, because I wanted >>> the lock to be sitting out of the node process, so that multiple >>> (node) processes can find out about it. >>> >>> Feedback welcome, of course. Let me know what you think. (My first >>> node thing on github! Also, my first github thing! :D ) >>> >>> -- >>> Rakesh Pai >>> Mumbai, India. >>> http://rakeshpai.me/ >>> http://twitter.com/rakesh314 >>> http://www.google.com/profiles/rakeshpai >>> >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en > > > > -- > Rakesh Pai > Mumbai, India. > http://rakeshpai.me/ > http://twitter.com/rakesh314 > http://www.google.com/profiles/rakeshpai > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
