From 64e51cacddc9b92b2ccab78f2eb72a7ea4bf73b0 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Fri, 19 May 2023 14:00:55 +0900 Subject: [PATCH] [Tizen 8.0 Migration][Service] Fix exception and change dummyTimer's interval 1) When the app has resumed If the service app has no onRequest function, JS exception can be raised. So, undefined check is necessary. 2) Because UvTaskRunner has 500ms interval, 100ms timer is not meaningful in Node application. Reference: https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/293070/ Change-Id: Id94e561e1c1e1c516c8c9ba82d664f83e2d6f404 Signed-off-by: DongHyun Song (cherry picked from commit 4ff972858c6fef14074e2d6ae797ee56a7ad8536) --- wrt_app/service/service_runner.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wrt_app/service/service_runner.ts b/wrt_app/service/service_runner.ts index 355347c..ef210c2 100644 --- a/wrt_app/service/service_runner.ts +++ b/wrt_app/service/service_runner.ts @@ -53,13 +53,13 @@ let requestStopService = (id: string) => { let app: any = null; let dummyTimer: any; -let periodLauncherAlive = 40; // 4s +let periodLauncherAlive = 8; // 4s, 500ms dummy timer checks the launcher aliveness every 8 times. let deviceApiRouter: any = null; let checkLauncherAlive = (id: string) => { periodLauncherAlive--; if (!periodLauncherAlive) { - periodLauncherAlive = 40; + periodLauncherAlive = 8; if (!wrt.checkLauncherAlive(id)) { console.debug(`${id} launcher was killed.`) requestStopService(id); @@ -99,7 +99,7 @@ export function start(id: string, filename: string) { if (isGlobalService()) { dummyTimer = setInterval(() => { checkLauncherAlive(id); - }, 100); + }, 500); } if (isServiceApplication()) { @@ -162,7 +162,7 @@ function run() { console.debug(`Received message type : ${message.type}`); switch (message.type) { case 'wake': - app?.onRequest(); + app?.onRequest?.(); break; case 'stop': stop(id); -- 2.7.4