@ikonintegration/ikapi 3.1.21 → 3.1.23

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": "@ikonintegration/ikapi",
3
- "version": "3.1.21",
3
+ "version": "3.1.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -15,6 +15,7 @@ import IKExecutionTracker from '../Tracker/IKExecutionTracker';
15
15
  export default class IKProcess {
16
16
  constructor(config, interval) {
17
17
  this._config = config;
18
+ this.allowExecutionIdentification = false;
18
19
  this.interval = interval;
19
20
  this.logger = new IKLogger(config.logger, Utils.logLevel());
20
21
  this.publisher = new IKPublisher(config.publisher);
@@ -33,6 +34,8 @@ export default class IKProcess {
33
34
  setInterval( async () => {
34
35
  await this._execute(executionFunc);
35
36
  }, this.interval);
37
+ //
38
+ if (this.allowExecutionIdentification && this.tracker) await this.tracker.stopTracking();
36
39
  }
37
40
  //Executions
38
41
  async _execute(executionFunc) {
@@ -46,7 +49,7 @@ export default class IKProcess {
46
49
  //Commit DB
47
50
  if (this.db) await this.db.commit();
48
51
  //Tracker
49
- if (this.tracker) await this.tracker.stopTracking();
52
+ if (this.tracker) await this.tracker.quickDrain();
50
53
  //
51
54
  executionFailed = false;
52
55
  } catch (e) { /*EXECUTION FAIL*/
@@ -16,6 +16,14 @@ export default class IKExecutionTracker {
16
16
  appendClaimer(value, key) { this.claimers[value] = key; }
17
17
  appendEvent(event) { this.client.appendEvent(event); }
18
18
  //
19
+ async quickDrain() {
20
+ try {
21
+ //Check for client and claimers
22
+ if (!this.client || Object.keys(this.claimers).length == 0) return; //disabled
23
+ //drain stats
24
+ await this.client.drain(this.claimers);
25
+ } catch (e) { console.error(`Error while draining tracker events: ${e}`); }
26
+ }
19
27
  async stopTracking() {
20
28
  try {
21
29
  //Check for client and claimers