-
Notifications
You must be signed in to change notification settings - Fork 172
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
version 5 (rewrite) #84
Conversation
Don't know if this is the right place to post this, feel free to delete it or tell me to move it elsewhere. I've been enamored by an api akin to redlock.acquire(resource, ttl, async () => {
...
}) where the resource is auto released at the end of the function---regardless of exceptions. If you're serious about going in the direction of auto-renewal, then I feel like we can absolutely get rid of the |
@gurupras that is almost exactly what is being added in this PR 😜 public async using<T>(
resources: string[],
duration: number,
settings: Settings,
routine?: (signal: RedlockAbortSignal) => T
): Promise<T>;
public async using<T>(
resources: string[],
duration: number,
routine: (signal: RedlockAbortSignal) => T
): Promise<T>; One of these days I'll have a chance to finish it up! |
I guess the tests should be written for current version 4, not for 5. It helps to be sure that there are no regressions in next major version. |
0b20bfb
to
03fc063
Compare
Hi folks! This major rewrite is finally looking the way I want. I still would like to add automated tests for compatibility with redis clusters, and more documentation would probably be helpful. These changes essentially amount to a full rewrite, and include:
I just published a pre-release on NPM as Any help testing this and vetting the changes would be appreciated! |
@mike-marcacci could you touch on why you don't wanna support |
+1 for @SimenB request. Apart from |
This is a draft rewrite that modernizes the library. The goals are to:
Promise
and async/await (feat: drop bluebird for native promises #70)Do note that this will be a major release as it contains breaking changes.
Most of these changes have been sitting on my laptop for some time and I have just been too busy to push this over the line. I'm creating a draft PR here so there's something to pick back up as I have a chance.