@rvoh/psychic-workers 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -325,7 +325,6 @@ class Background {
325
325
  /////////////////////////
326
326
  const namedQueueOptionsMap = nativeBullMQ.namedQueueOptions || {};
327
327
  Object.keys(namedQueueOptionsMap).forEach(queueName => {
328
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
329
328
  const namedQueueOptions = namedQueueOptionsMap[queueName];
330
329
  if (namedQueueOptions.queueConnection)
331
330
  this.redisConnections.push(namedQueueOptions.queueConnection);
@@ -372,7 +371,12 @@ class Background {
372
371
  * starts background workers
373
372
  */
374
373
  work() {
375
- this.connect({ activateWorkers: true });
374
+ process.on('uncaughtException', (error) => {
375
+ psychic_1.PsychicApp.log('[psychic-workers] uncaughtException:', error);
376
+ });
377
+ process.on('unhandledRejection', (error) => {
378
+ psychic_1.PsychicApp.log('[psychic-workers] unhandledRejection:', error);
379
+ });
376
380
  process.on('SIGTERM', () => {
377
381
  if (!EnvInternal_js_1.default.isTest)
378
382
  psychic_1.PsychicApp.log('[psychic-workers] handle SIGTERM');
@@ -387,6 +391,7 @@ class Background {
387
391
  .then(() => { })
388
392
  .catch(() => { });
389
393
  });
394
+ this.connect({ activateWorkers: true });
390
395
  }
391
396
  /**
392
397
  * adds the static method of a provided class to BullMQ
@@ -321,7 +321,6 @@ export class Background {
321
321
  /////////////////////////
322
322
  const namedQueueOptionsMap = nativeBullMQ.namedQueueOptions || {};
323
323
  Object.keys(namedQueueOptionsMap).forEach(queueName => {
324
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
325
324
  const namedQueueOptions = namedQueueOptionsMap[queueName];
326
325
  if (namedQueueOptions.queueConnection)
327
326
  this.redisConnections.push(namedQueueOptions.queueConnection);
@@ -368,7 +367,12 @@ export class Background {
368
367
  * starts background workers
369
368
  */
370
369
  work() {
371
- this.connect({ activateWorkers: true });
370
+ process.on('uncaughtException', (error) => {
371
+ PsychicApp.log('[psychic-workers] uncaughtException:', error);
372
+ });
373
+ process.on('unhandledRejection', (error) => {
374
+ PsychicApp.log('[psychic-workers] unhandledRejection:', error);
375
+ });
372
376
  process.on('SIGTERM', () => {
373
377
  if (!EnvInternal.isTest)
374
378
  PsychicApp.log('[psychic-workers] handle SIGTERM');
@@ -383,6 +387,7 @@ export class Background {
383
387
  .then(() => { })
384
388
  .catch(() => { });
385
389
  });
390
+ this.connect({ activateWorkers: true });
386
391
  }
387
392
  /**
388
393
  * adds the static method of a provided class to BullMQ
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@rvoh/psychic-workers",
4
4
  "description": "Background job system for Psychic applications",
5
- "version": "0.4.1",
5
+ "version": "0.4.2",
6
6
  "author": "RVO Health",
7
7
  "repository": {
8
8
  "type": "git",
@@ -53,7 +53,7 @@
53
53
  "@types/node": "^22.5.1",
54
54
  "@types/pg": "^8",
55
55
  "@types/supertest": "^6.0.2",
56
- "bullmq": "^5.49.1",
56
+ "bullmq": "^5.52.0",
57
57
  "eslint": "^9.9.1",
58
58
  "express": "^4.21.2",
59
59
  "ioredis": "^5.4.1",