Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme - new args for the using() example #303

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ The `using` method wraps and executes a routine in the context of an auto-extend
The first parameter is an array of resources to lock; the second is the requested lock duration in milliseconds, which MUST NOT contain values after the decimal.

```ts
await redlock.using([senderId, recipientId], 5000, async (signal) => {
await redlock.using(["foo", "bar"], 5000, async (signal) => {
// Do something...
await something();
await something("foo");

// Make sure any attempted lock extension has not failed.
if (signal.aborted) {
throw signal.error;
}

// Do something else...
await somethingElse();
await somethingElse("bar");
});
```

Expand Down