3.0.2 • Published 4 years ago

do-with-redis-lock v3.0.2

Weekly downloads
142
License
-
Repository
github
Last release
4 years ago

do-with-redis-lock

usage

redisConn = {
  port: 9000,
  host: "...",
  auth: "...",
  db: 1 #optional
}
doWithLock = require("do-with-redis-lock")(redisConn)

action = ->
  request.getAsync(...) # something that returns a Promise

doWithLock(action, key).then (result) ->
  # continue...

If a concurrency problem appears, the Promise is rejected with:

{
  statusCode: 503,
  body: {
    code: "concurrency_conflict",
    message: "Somebody is doing this at the same time at you"
  }
}

migration

1.x users

  • In 2.x, the Promise's rejection reason isn't "concurrency_conflict" anymore. See above.

2.x users

  • In 3.x, the connection credentials are no longer environment variables. They are passed by parameters instead. See above.
3.0.2

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.5.0

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago