Add processor heartbeat management and improve health check functionality
All checks were successful
Publish FaceAI Container / publish (push) Successful in 3m7s
All checks were successful
Publish FaceAI Container / publish (push) Successful in 3m7s
- Introduced processor heartbeat configuration in environment variables and Docker setup. - Implemented heartbeat publishing in the processor worker. - Enhanced health check endpoint to include processor availability status. - Updated frontend components to handle processor unavailability messages. - Added legacy return functionality in the upload panel.
This commit is contained in:
parent
c0732c142c
commit
87d9238795
14 changed files with 292 additions and 23 deletions
|
|
@ -10,6 +10,7 @@ import {
|
|||
markSearchFailed,
|
||||
markSearchProcessing,
|
||||
releaseActiveSearchLock,
|
||||
updateProcessorHeartbeat,
|
||||
storeResultRecord
|
||||
} from '../../backend/src/redis-store.js';
|
||||
import { parseMatcherCsv, resolvePklPath, runFaceMatcher } from './worker-utils.js';
|
||||
|
|
@ -34,6 +35,18 @@ async function ensureMatcherBinaryAvailable() {
|
|||
|
||||
console.log(`FaceAI processor configured matcher binary: ${config.matcherBinary}`);
|
||||
|
||||
async function publishProcessorHeartbeat() {
|
||||
try {
|
||||
await updateProcessorHeartbeat(connection, config.processorHeartbeatTtlSeconds, {
|
||||
pid: process.pid,
|
||||
queueName: config.queueName,
|
||||
matcherBinary: config.matcherBinary
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Unable to publish FaceAI processor heartbeat:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function formatLogLine(message, details) {
|
||||
const timestamp = new Date().toISOString();
|
||||
if (details === undefined) {
|
||||
|
|
@ -167,6 +180,13 @@ async function processJob(job) {
|
|||
}
|
||||
|
||||
await ensureMatcherBinaryAvailable();
|
||||
await publishProcessorHeartbeat();
|
||||
|
||||
const heartbeatTimer = setInterval(() => {
|
||||
publishProcessorHeartbeat();
|
||||
}, config.processorHeartbeatIntervalMs);
|
||||
|
||||
heartbeatTimer.unref();
|
||||
|
||||
const worker = new Worker(config.queueName, processJob, {
|
||||
connection,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue