[Service] Handle exception if workerData is empty 12/263912/4
authorDongHyun Song <dh81.song@samsung.com>
Mon, 13 Sep 2021 09:13:55 +0000 (18:13 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Mon, 13 Sep 2021 09:29:19 +0000 (18:29 +0900)
Sometimes, we are facing, there is a case of workerData is empty.
empty 'id' makes kind of smack error and JavaScript errors.

This issue has been reported from long aging test.

Change-Id: Ib287eecc3906e313dc5b23491aa04939b88543cf
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/service/service_runner.ts

index e3cb9bd..63766c7 100644 (file)
@@ -132,6 +132,11 @@ export function stop(id: string) {
 
 function run() {
   let id = workerData.id;
+  if (!id) {
+    console.debug('workerData.id is empty!');
+    process.exit();
+  }
+
   Object.defineProperty(global, 'internalId', {
     value: id,
     writable: false