Release v2.10.3
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m13s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 31s

This commit is contained in:
2026-08-29 01:56:45 +01:00
parent 30814f3f46
commit 3f4f57020a
60 changed files with 1075 additions and 523 deletions
+25 -3
View File
@@ -1,3 +1,5 @@
// Database pool setup and lifecycle maintenance for persisted onboarding devices.
const mysql = require('mysql2/promise');
function createPool() {
@@ -15,14 +17,34 @@ function createPool() {
}
async function pruneStaleOnboardingDevices(pool) {
// Uncompleted pairings expire quickly; completed bindings use their persisted heartbeat instead.
await pool.query(
`DELETE FROM d_onboarding_devices
WHERE screen_id IS NULL
AND modified_at < (CURRENT_TIMESTAMP - INTERVAL 1 MINUTE)`
WHERE (screen_id IS NULL
AND modified_at < (CURRENT_TIMESTAMP - INTERVAL 15 MINUTE))
OR (last_seen_at IS NOT NULL
AND last_seen_at < (CURRENT_TIMESTAMP - INTERVAL 24 HOUR))`
);
}
async function touchOnboardingDeviceLastSeen(pool, deviceId) {
const deviceIds = (Array.isArray(deviceId) ? deviceId : [deviceId])
.map(function (value) { return String(value || '').trim(); })
.filter(Boolean);
if (!deviceIds.length) {
return;
}
await pool.query(
`UPDATE d_onboarding_devices
SET last_seen_at = CURRENT_TIMESTAMP
WHERE device_id IN (${deviceIds.map(function () { return '?'; }).join(', ')})`,
deviceIds
);
}
module.exports = {
createPool,
pruneStaleOnboardingDevices
pruneStaleOnboardingDevices,
touchOnboardingDeviceLastSeen
};