mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 10:00:46 -04:00
jfhdskljh
This commit is contained in:
@@ -92,9 +92,13 @@ const idleActions = [
|
||||
|
||||
async function runIdleActions() {
|
||||
const results = [];
|
||||
logger.info('Idle action pipeline starting', {
|
||||
actions: idleActions.map((action) => action.name),
|
||||
});
|
||||
for (const action of idleActions) {
|
||||
try {
|
||||
const result = await action();
|
||||
logger.info('Idle action completed', { action: action.name, result });
|
||||
results.push({ ok: true, result });
|
||||
} catch (err) {
|
||||
logger.warn('Idle action failed', { action: action.name, error: err.message });
|
||||
|
||||
@@ -36,6 +36,7 @@ function clearIdleTimer() {
|
||||
if (runtime.timer) {
|
||||
clearTimeout(runtime.timer);
|
||||
runtime.timer = null;
|
||||
logger.info('Idle timer cleared');
|
||||
}
|
||||
runtime.deadlineAt = null;
|
||||
}
|
||||
@@ -43,6 +44,10 @@ function clearIdleTimer() {
|
||||
function scheduleIdleTimer() {
|
||||
if (runtime.timer) return;
|
||||
runtime.deadlineAt = Date.now() + IDLE_TIMEOUT_MS;
|
||||
logger.info('Idle timer scheduled', {
|
||||
timeoutMs: IDLE_TIMEOUT_MS,
|
||||
deadlineAt: runtime.deadlineAt,
|
||||
});
|
||||
runtime.timer = setTimeout(async () => {
|
||||
runtime.timer = null;
|
||||
runtime.deadlineAt = null;
|
||||
@@ -64,6 +69,7 @@ function scheduleIdleTimer() {
|
||||
|
||||
function refreshIdleState() {
|
||||
const activity = getActivitySnapshot();
|
||||
logger.info('Idle state refresh', activity);
|
||||
if (activity.totalActive > 0) {
|
||||
clearIdleTimer();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user