errorception / redis-lock

Implements a locking primitive using redis. An implementation of the algorithm described at https://redis.io/commands/setnx
211 stars 48 forks source link

Use newer native REDIS commands #11

Closed mike-marcacci closed 9 years ago

mike-marcacci commented 10 years ago

Much simpler, a little faster, and a just a touch more reliable. Uses the slightly newer SET key value PX 123 NX syntax.

rakeshpai commented 10 years ago

Thanks for this, @mike-marcacci. This is awesome!

However, I can't seem to get the tests to run. Could you give it a shot? You should be able to run the tests by running npm test.

mike-marcacci commented 10 years ago

Hi @rakeshpai,

Here are my test results:

> redis-lock@0.0.8 test /Users/michaelmarcacci/Desktop/redis-lock
> ./node_modules/mocha/bin/mocha

\
.\.|

  ✔ 3 tests complete (1028ms)
LoicMahieu commented 10 years ago

Nice!

LoicMahieu commented 9 years ago

bump @rakeshpai @errorception Need to merge :+1: !

luin commented 9 years ago

would like to see this pr been merged @rakeshpai

toblerpwn commented 9 years ago

+1

rakeshpai commented 9 years ago

I'd merge this, but something's screwed up with my setup, and I can't get the tests to run. If someone can confirm that all tests pass sufficiently, I'll merge this. I know that @mike-marcacci has already confirmed that the tests pass, but it would be great if I could get a second opinion.

rosskukulinski commented 9 years ago

@rakeshpai: I just pulled down mike-marcacci:master and ran npm test:

[~/dev/opensource/redis-lock (master)]$ npm test

> redis-lock@0.0.8 test /Users/rossk/dev/opensource/redis-lock
> ./node_modules/mocha/bin/mocha

  ...

  ✔ 3 tests complete (1087ms)
LoicMahieu commented 9 years ago
# ~/Repos/redis-lock on git:mike/master o $ npm test
> redis-lock@0.0.8 test /Users/loicmahieu/Repos/redis-lock
> ./node_modules/mocha/bin/mocha

  ...

  ✔ 3 tests complete (1133ms)

Is there any reason why tests are not run on travis ? It would be easier :)

rakeshpai commented 9 years ago

Thanks for the help, everyone. I've merged this, and released this with a minor version bump. So, this patch has bumped up this package to 0.1.0.

Also, figured out the issue with my setup - turns out, my redis-server was too outdated.