xcraft-core-utils 4.3.6 → 4.3.9

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/.zou-flow ADDED
@@ -0,0 +1,3 @@
1
+ [update-version]
2
+ freezed = true
3
+ package-json = package.json
package/lib/job-queue.js CHANGED
@@ -32,14 +32,18 @@ class JobQueue {
32
32
  this.waitDelay = options.waitDelay;
33
33
  this.channel = name.toLowerCase().replace(/\.|\[|\//g, '-');
34
34
  this.runner = watt(function* (...args) {
35
- this.running++;
36
35
  this.runningSamples++;
37
- yield* runner(...args);
36
+ try {
37
+ yield* runner(...args);
38
+ } finally {
39
+ this.endOfRunningSamples++;
40
+ }
38
41
  });
39
42
  this.parallelLimit = parallelLimit;
40
43
  this.waiting = new Map();
41
44
  this.running = 0;
42
45
  this.runningSamples = 0;
46
+ this.endOfRunningSamples = 0;
43
47
  this._mutex = new locks.Mutex();
44
48
  const busClient = require('xcraft-core-busclient').getGlobal();
45
49
  this.resp = busClient.newResponse('job-queue', 'token');
@@ -58,7 +62,8 @@ class JobQueue {
58
62
  current: 0,
59
63
  total: 0,
60
64
  });
61
- this.runningSamples = 0;
65
+ this.runningSamples -= this.endOfRunningSamples;
66
+ this.endOfRunningSamples = 0;
62
67
  }
63
68
 
64
69
  _log() {
@@ -66,6 +66,7 @@ class Runner {
66
66
  }
67
67
 
68
68
  //update counters
69
+ jobQueue.running++;
69
70
  this.totalRunning++;
70
71
 
71
72
  //trigger job start on queue runner
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xcraft-core-utils",
3
- "version": "4.3.6",
3
+ "version": "4.3.9",
4
4
  "description": "Xcraft utils",
5
5
  "main": "index.js",
6
6
  "engines": {