From a29493c357387bdb83e421ff2996f67f20218036 Mon Sep 17 00:00:00 2001 From: akshatdubeysf <77672713+akshatdubeysf@users.noreply.github.com> Date: Mon, 19 Jul 2021 19:33:47 +0530 Subject: [PATCH] fix(bpmn-service): fix multiple workflow worker registration issue (#268) * fix(bpmn-service): fix single workflow registration issue GH-267 --- .../src/providers/register-worker.service.ts | 9 ++++--- services/notification-service/README.md | 26 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/services/bpmn-service/src/providers/register-worker.service.ts b/services/bpmn-service/src/providers/register-worker.service.ts index 723a380f8a..95e1305f0a 100644 --- a/services/bpmn-service/src/providers/register-worker.service.ts +++ b/services/bpmn-service/src/providers/register-worker.service.ts @@ -13,12 +13,13 @@ export class WorkerRegisterFnProvider implements Provider { value(): WorkerRegisterFn { return async (workflowName, topic, command) => { let workerMap = await this.workerMapGetter(); - if (workerMap?.[workflowName]) { + if (!workerMap) { + workerMap = {}; + } + if (workerMap[workflowName]) { workerMap[workflowName].push({topic, command, running: false}); } else { - workerMap = { - [workflowName]: [{topic, command, running: false}], - }; + workerMap[workflowName] = [{topic, command, running: false}]; this.workerMapSetter(workerMap); } }; diff --git a/services/notification-service/README.md b/services/notification-service/README.md index 9593a62c0e..2f191937b2 100644 --- a/services/notification-service/README.md +++ b/services/notification-service/README.md @@ -85,7 +85,7 @@ npm i @sourceloop/notification-service - **Push Notifications with Pubnub** - - Bind the Pubnub Config to the `PubNubProvider.Config` key - ``` typescript - this.bind(PubNubProvider.Config).to({ + this.bind(PubnubBindings.Config).to({ subscribeKey: process.env.PUBNUB_SUBSCRIBE_KEY, publishKey: process.env.PUBNUB_PUBLISH_KEY, secretKey: process.env.PUBNUB_SECRET_KEY, @@ -248,18 +248,18 @@ npm i @sourceloop/notification-service ### Environment Variables -| Name | Required | Default Value | Description | -| ------------- | -------- | ------------- | ------------------------------------------------------------ | -| `NODE_ENV` | Y | | Node environment value, i.e. `dev`, `test`, `prod` | -| `LOG_LEVEL` | Y | | Log level value, i.e. `error`, `warn`, `info`, `verbose`, `debug` | -| `DB_HOST` | Y | | Hostname for the database server. | -| `DB_PORT` | Y | | Port for the database server. | -| `DB_USER` | Y | | User for the database. | -| `DB_PASSWORD` | Y | | Password for the database user. | -| `DB_DATABASE` | Y | | Database to connect to on the database server. | +| Name | Required | Default Value | Description | +| ------------- | -------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `NODE_ENV` | Y | | Node environment value, i.e. `dev`, `test`, `prod` | +| `LOG_LEVEL` | Y | | Log level value, i.e. `error`, `warn`, `info`, `verbose`, `debug` | +| `DB_HOST` | Y | | Hostname for the database server. | +| `DB_PORT` | Y | | Port for the database server. | +| `DB_USER` | Y | | User for the database. | +| `DB_PASSWORD` | Y | | Password for the database user. | +| `DB_DATABASE` | Y | | Database to connect to on the database server. | | `DB_SCHEMA` | Y | | Database schema used for the data source. In PostgreSQL, this will be `public` unless a schema is made explicitly for the service. | -| `JWT_SECRET` | Y | | Symmetric signing key of the JWT token. | -| `JWT_ISSUER` | Y | | Issuer of the JWT token. | +| `JWT_SECRET` | Y | | Symmetric signing key of the JWT token. | +| `JWT_ISSUER` | Y | | Issuer of the JWT token. | ### Setting up a `DataSource` @@ -324,4 +324,4 @@ Authorization: Bearer where is a JWT token signed using JWT issu ## API's Details -Visit the [OpenAPI spec docs](./openapi.md) \ No newline at end of file +Visit the [OpenAPI spec docs](./openapi.md)