1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00
This commit is contained in:
Adria Navarro 2023-11-30 18:36:36 +01:00
parent fb72b77ac1
commit 670853a0ea
2 changed files with 4 additions and 4 deletions

View file

@ -101,7 +101,7 @@ function getLockName(opts: LockOptions) {
return name
}
export const autoExtendPollingMs = Duration.fromSeconds(10).toMs()
export const AUTO_EXTEND_POLLING_MS = Duration.fromSeconds(10).toMs()
export async function doWithLock<T>(
opts: LockOptions,
@ -114,7 +114,7 @@ export async function doWithLock<T>(
const name = getLockName(opts)
const ttl =
opts.type === LockType.AUTO_EXTEND ? autoExtendPollingMs : opts.ttl
opts.type === LockType.AUTO_EXTEND ? AUTO_EXTEND_POLLING_MS : opts.ttl
// create the lock
lock = await redlock.lock(name, ttl)

View file

@ -1,5 +1,5 @@
import { LockName, LockType, LockOptions } from "@budibase/types"
import { autoExtendPollingMs, doWithLock } from "../redlockImpl"
import { AUTO_EXTEND_POLLING_MS, doWithLock } from "../redlockImpl"
import { DBTestConfiguration, generator } from "../../../tests"
describe("redlockImpl", () => {
@ -9,7 +9,7 @@ describe("redlockImpl", () => {
describe("doWithLock", () => {
const config = new DBTestConfiguration()
const lockTtl = autoExtendPollingMs
const lockTtl = AUTO_EXTEND_POLLING_MS
function runLockWithExecutionTime({
opts,