1
0
Fork 0
mirror of synced 2024-08-14 01:21:41 +12:00

Use new autoextend

This commit is contained in:
Adria Navarro 2023-11-30 12:22:05 +01:00
parent 63339eb686
commit 91b293fd49

View file

@ -11,10 +11,6 @@ import environment from "../environment"
const appMigrationQueue = queue.createQueue(queue.JobQueue.APP_MIGRATION) const appMigrationQueue = queue.createQueue(queue.JobQueue.APP_MIGRATION)
appMigrationQueue.process(processMessage) appMigrationQueue.process(processMessage)
// TODO
export const PROCESS_MIGRATION_TIMEOUT =
environment.APP_MIGRATION_TIMEOUT || 60000
async function processMessage(job: Job) { async function processMessage(job: Job) {
const { appId } = job.data const { appId } = job.data
console.log(`Processing app migration for "${appId}"`) console.log(`Processing app migration for "${appId}"`)
@ -22,9 +18,9 @@ async function processMessage(job: Job) {
await locks.doWithLock( await locks.doWithLock(
{ {
name: LockName.APP_MIGRATION, name: LockName.APP_MIGRATION,
type: LockType.DEFAULT, type: LockType.AUTO_EXTEND,
resource: appId, resource: appId,
ttl: PROCESS_MIGRATION_TIMEOUT, ttl: 60000,
}, },
async () => { async () => {
await context.doInAppContext(appId, async () => { await context.doInAppContext(appId, async () => {