Type locks

This commit is contained in:
adrinr 2023-02-28 12:47:28 +01:00
parent a385fde601
commit 24161d12bf
1 changed files with 4 additions and 1 deletions

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 {