1
0
Fork 0
mirror of synced 2024-09-10 22:46:09 +12:00

Type locks

This commit is contained in:
adrinr 2023-02-28 12:47:28 +01:00
parent a385fde601
commit 24161d12bf

View file

@ -63,7 +63,10 @@ export const newRedlock = async (opts: Options = {}) => {
return new Redlock([client], options)
}
export const doWithLock = async (opts: LockOptions, task: any) => {
export const doWithLock = async <T>(
opts: LockOptions,
task: () => Promise<T>
) => {
const redlock = await getClient(opts.type)
let lock
try {