tidying
parent
18f5dc7103
commit
1e50035474
|
|
@ -29,7 +29,7 @@ cluster.on('message', (worker, message) => {
|
||||||
if (worker === undefined || pid === message.pid) {
|
if (worker === undefined || pid === message.pid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
debug('Relaying message to workers');
|
debug(`Relaying message to worker: ${pid}`);
|
||||||
worker.send(message);
|
worker.send(message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ cluster.on('message', (worker, message: WorkerMessage) => {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('Relaying message to workers')
|
debug(`Relaying message to worker: ${pid}`)
|
||||||
worker.send(message)
|
worker.send(message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ export async function handler(request, response) {
|
||||||
lotId
|
lotId
|
||||||
});
|
});
|
||||||
response.on('finish', () => {
|
response.on('finish', () => {
|
||||||
clearNextPreviousLotIdCache();
|
clearNextPreviousLotIdCache(-1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export default handler;
|
export default handler;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export async function handler(
|
||||||
})
|
})
|
||||||
|
|
||||||
response.on('finish', () => {
|
response.on('finish', () => {
|
||||||
clearNextPreviousLotIdCache()
|
clearNextPreviousLotIdCache(-1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export async function handler(request, response) {
|
||||||
success
|
success
|
||||||
});
|
});
|
||||||
response.on('finish', () => {
|
response.on('finish', () => {
|
||||||
clearNextPreviousLotIdCache();
|
clearNextPreviousLotIdCache(-1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export default handler;
|
export default handler;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export async function handler(
|
||||||
})
|
})
|
||||||
|
|
||||||
response.on('finish', () => {
|
response.on('finish', () => {
|
||||||
clearNextPreviousLotIdCache()
|
clearNextPreviousLotIdCache(-1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* eslint-disable @typescript-eslint/indent */
|
||||||
|
|
||||||
import cluster from 'node:cluster'
|
import cluster from 'node:cluster'
|
||||||
|
|
||||||
import NodeCache from 'node-cache'
|
import NodeCache from 'node-cache'
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type RecordTable =
|
||||||
| 'WorkOrderMilestoneTypes'
|
| 'WorkOrderMilestoneTypes'
|
||||||
| 'WorkOrderTypes'
|
| 'WorkOrderTypes'
|
||||||
|
|
||||||
const recordIdColumns: Map<RecordTable, string> = new Map()
|
const recordIdColumns = new Map<RecordTable, string>()
|
||||||
recordIdColumns.set('FeeCategories', 'feeCategoryId')
|
recordIdColumns.set('FeeCategories', 'feeCategoryId')
|
||||||
recordIdColumns.set('Fees', 'feeId')
|
recordIdColumns.set('Fees', 'feeId')
|
||||||
recordIdColumns.set('Lots', 'lotId')
|
recordIdColumns.set('Lots', 'lotId')
|
||||||
|
|
@ -44,7 +44,7 @@ recordIdColumns.set('WorkOrderMilestones', 'workOrderMilestoneId')
|
||||||
recordIdColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneTypeId')
|
recordIdColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneTypeId')
|
||||||
recordIdColumns.set('WorkOrderTypes', 'workOrderTypeId')
|
recordIdColumns.set('WorkOrderTypes', 'workOrderTypeId')
|
||||||
|
|
||||||
const relatedTables: Map<RecordTable, string[]> = new Map()
|
const relatedTables = new Map<RecordTable, string[]>()
|
||||||
relatedTables.set('FeeCategories', ['Fees'])
|
relatedTables.set('FeeCategories', ['Fees'])
|
||||||
relatedTables.set('Lots', ['LotFields', 'LotComments'])
|
relatedTables.set('Lots', ['LotFields', 'LotComments'])
|
||||||
relatedTables.set('LotOccupancies', [
|
relatedTables.set('LotOccupancies', [
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { addOrUpdateLotField } from './addOrUpdateLotField.js';
|
import { addOrUpdateLotField } from './addOrUpdateLotField.js';
|
||||||
import { deleteLotField } from './deleteLotField.js';
|
import { deleteLotField } from './deleteLotField.js';
|
||||||
import { clearNextPreviousLotIdCache } from '../functions.lots.js';
|
|
||||||
export async function updateLot(lotForm, requestSession) {
|
export async function updateLot(lotForm, requestSession) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const rightNowMillis = Date.now();
|
const rightNowMillis = Date.now();
|
||||||
|
|
@ -33,9 +32,6 @@ export async function updateLot(lotForm, requestSession) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
database.release();
|
database.release();
|
||||||
clearNextPreviousLotIdCache(typeof lotForm.lotId === 'number'
|
|
||||||
? lotForm.lotId
|
|
||||||
: Number.parseInt(lotForm.lotId, 10));
|
|
||||||
return result.changes > 0;
|
return result.changes > 0;
|
||||||
}
|
}
|
||||||
export async function updateLotStatus(lotId, lotStatusId, requestSession) {
|
export async function updateLotStatus(lotId, lotStatusId, requestSession) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { addOrUpdateLotField } from './addOrUpdateLotField.js'
|
||||||
import { deleteLotField } from './deleteLotField.js'
|
import { deleteLotField } from './deleteLotField.js'
|
||||||
|
|
||||||
import type * as recordTypes from '../../types/recordTypes'
|
import type * as recordTypes from '../../types/recordTypes'
|
||||||
import { clearNextPreviousLotIdCache } from '../functions.lots.js'
|
|
||||||
|
|
||||||
interface UpdateLotForm {
|
interface UpdateLotForm {
|
||||||
lotId: string | number
|
lotId: string | number
|
||||||
|
|
@ -88,12 +87,6 @@ export async function updateLot(
|
||||||
|
|
||||||
database.release()
|
database.release()
|
||||||
|
|
||||||
clearNextPreviousLotIdCache(
|
|
||||||
typeof lotForm.lotId === 'number'
|
|
||||||
? lotForm.lotId
|
|
||||||
: Number.parseInt(lotForm.lotId, 10)
|
|
||||||
)
|
|
||||||
|
|
||||||
return result.changes > 0
|
return result.changes > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue