zyket 1.0.22 → 1.0.24

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyket",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -40,6 +40,8 @@ module.exports = class Kernel {
40
40
  httpServer: this.#httpServer.server,
41
41
  });
42
42
  }
43
+
44
+ return this;
43
45
  }
44
46
 
45
47
  async #registerServices(servicesToRegister = []) {
@@ -48,9 +48,12 @@ module.exports = class BullMQ extends Service {
48
48
  this.#createWorkersFolder(workersFolder);
49
49
  const workers = (await fg('**/*.js', { cwd: workersFolder })).map((wkr) => {
50
50
  const worker = require(path.join(workersFolder, wkr));
51
- if(!(worker.prototype instanceof Worker)) throw new Error(`${wkr} is not a valid handler`);
51
+ if(!(worker.prototype instanceof Worker)) {
52
+ this.#container.get('logger').warn(`File ${wkr} does not export a valid Worker class, skipping...`);
53
+ return null;
54
+ }
52
55
  return new worker(wkr.replace('.js', ''));
53
- });
56
+ }).filter(wkr => wkr !== null);
54
57
  return workers;
55
58
  }
56
59