Renames
This commit is contained in:
parent
fb72b77ac1
commit
670853a0ea
|
@ -101,7 +101,7 @@ function getLockName(opts: LockOptions) {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
export const autoExtendPollingMs = Duration.fromSeconds(10).toMs()
|
export const AUTO_EXTEND_POLLING_MS = Duration.fromSeconds(10).toMs()
|
||||||
|
|
||||||
export async function doWithLock<T>(
|
export async function doWithLock<T>(
|
||||||
opts: LockOptions,
|
opts: LockOptions,
|
||||||
|
@ -114,7 +114,7 @@ export async function doWithLock<T>(
|
||||||
const name = getLockName(opts)
|
const name = getLockName(opts)
|
||||||
|
|
||||||
const ttl =
|
const ttl =
|
||||||
opts.type === LockType.AUTO_EXTEND ? autoExtendPollingMs : opts.ttl
|
opts.type === LockType.AUTO_EXTEND ? AUTO_EXTEND_POLLING_MS : opts.ttl
|
||||||
|
|
||||||
// create the lock
|
// create the lock
|
||||||
lock = await redlock.lock(name, ttl)
|
lock = await redlock.lock(name, ttl)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { LockName, LockType, LockOptions } from "@budibase/types"
|
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"
|
import { DBTestConfiguration, generator } from "../../../tests"
|
||||||
|
|
||||||
describe("redlockImpl", () => {
|
describe("redlockImpl", () => {
|
||||||
|
@ -9,7 +9,7 @@ describe("redlockImpl", () => {
|
||||||
|
|
||||||
describe("doWithLock", () => {
|
describe("doWithLock", () => {
|
||||||
const config = new DBTestConfiguration()
|
const config = new DBTestConfiguration()
|
||||||
const lockTtl = autoExtendPollingMs
|
const lockTtl = AUTO_EXTEND_POLLING_MS
|
||||||
|
|
||||||
function runLockWithExecutionTime({
|
function runLockWithExecutionTime({
|
||||||
opts,
|
opts,
|
||||||
|
|
Loading…
Reference in New Issue