ignore invocation of worker process if already running
[websub-hub] / src / manager.js
index b3aff45da975952ea8ad27d51aa058823348cbdd..fddc8e45ae6f272a346c2131a05d909c190d03d9 100644 (file)
@@ -40,7 +40,7 @@ class Manager {
    * @param {http.ServerResponse} res
    * @param {object} ctx
    */
-   async getHealthcheck(res, ctx) {
+  async getHealthcheck(res, ctx) {
     const _scope = _fileScope('getHealthcheck');
     const health = 'happy';
 
@@ -342,7 +342,7 @@ class Manager {
       let fn, info, id;
       try {
         if (data.mode === Enum.Mode.Publish) {
-          fn = 'topicPublish';
+          fn = 'topicFetchRequested';
           info = await this.db.topicFetchRequested(dbCtx, data.topicId);
           id = data.topicId;
         } else {
@@ -366,7 +366,7 @@ class Manager {
             fn = 'topicFetchClaimAndProcessById';
             await this.communication.topicFetchClaimAndProcessById(dbCtx, id, requestId);
           } else {
-            fn = 'processVerification';
+            fn = 'verificationClaimAndProcessById';
             await this.communication.verificationClaimAndProcessById(dbCtx, id, requestId);
           }
         } catch (e) {
@@ -666,7 +666,9 @@ class Manager {
     this.logger.debug(_scope, 'called', { ctx });
 
     // N.B. no await on this
-    this.communication.worker.process();
+    this.communication.worker.process().catch((e) => {
+      this.logger.error(_scope, 'failed', { error: e, ctx });
+    });
 
     res.end();
     this.logger.info(_scope, 'invoked worker process', { ctx });