Add processor heartbeat management and improve health check functionality
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:
MaddoScientisto 2026-04-19 11:50:11 +02:00
commit 87d9238795
14 changed files with 292 additions and 23 deletions

View file

@ -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,