From 0c0b4ba4a042dd6bd4f6c298f12526473e7fda29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr> Date: Mon, 28 Mar 2022 17:04:59 +0200 Subject: [PATCH] [ivette] better feedback on polling --- ivette/src/frama-c/server.ts | 4 ++++ ivette/src/renderer/Controller.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ivette/src/frama-c/server.ts b/ivette/src/frama-c/server.ts index 4c8fd9181ee..09cdc896292 100644 --- a/ivette/src/frama-c/server.ts +++ b/ivette/src/frama-c/server.ts @@ -198,6 +198,8 @@ function _status(newStatus: Status): void { } } +const _update: () => void = debounce(() => STATUS.emit(status), 100); + // -------------------------------------------------------------------------- // --- Server Control (Start) // -------------------------------------------------------------------------- @@ -737,6 +739,7 @@ export function send<In, Out>( pollingTimer = setInterval(() => { client.poll(); }, polling); + _update(); } return response; } @@ -749,6 +752,7 @@ function _resolved(id: string): void { pending.delete(id); if (pending.size === 0) { rqCount = 0; + _update(); if (pollingTimer) { clearInterval(pollingTimer); pollingTimer = undefined; diff --git a/ivette/src/renderer/Controller.tsx b/ivette/src/renderer/Controller.tsx index 3cd1379e165..5fb9c65e592 100644 --- a/ivette/src/renderer/Controller.tsx +++ b/ivette/src/renderer/Controller.tsx @@ -385,7 +385,8 @@ export const Status = () => { running = 'BOOT'; break; case Server.Status.ON: - led = pending > 0 ? 'positive' : 'active'; + led = 'active'; + blink = pending > 0; running = 'ON'; break; case Server.Status.HALTING: -- GitLab