@wdio/sumologic-reporter 9.31.2 → 9.31.6

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/build/index.d.ts CHANGED
@@ -10,6 +10,8 @@ export default class SumoLogicReporter extends WDIOReporter {
10
10
  private _unsynced;
11
11
  private _isSynchronising;
12
12
  private _hasRunnerEnd;
13
+ private _retryDelay;
14
+ private _nextRetryAt;
13
15
  constructor(options: Options);
14
16
  get isSynchronised(): boolean;
15
17
  onRunnerStart(runner: RunnerStats): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAGzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AA4BzC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAgB;IAEjC,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,aAAa,CAAQ;gBAEjB,OAAO,EAAE,OAAO;IAmB5B,IAAI,cAAc,YAEjB;IAED,aAAa,CAAC,MAAM,EAAE,WAAW;IAQjC,YAAY,CAAC,KAAK,EAAE,UAAU;IAQ9B,WAAW,CAAC,IAAI,EAAE,SAAS;IAQ3B,UAAU,CAAC,IAAI,EAAE,SAAS;IAQ1B,UAAU,CAAC,IAAI,EAAE,SAAS;IAQ1B,UAAU,CAAC,IAAI,EAAE,SAAS;IAQ1B,SAAS,CAAC,IAAI,EAAE,SAAS;IAQzB,UAAU,CAAC,KAAK,EAAE,UAAU;IAQ5B,WAAW,CAAC,MAAM,EAAE,WAAW;IASzB,IAAI;CA8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,7 @@ import WDIOReporter from "@wdio/reporter";
4
4
  import logger from "@wdio/logger";
5
5
  var log = logger("@wdio/sumologic-reporter");
6
6
  var MAX_LINES = 100;
7
+ var MAX_RETRY_DELAY = 1e3;
7
8
  function formatDate(date) {
8
9
  const year = date.getFullYear();
9
10
  const month = String(date.getMonth() + 1).padStart(2, "0");
@@ -25,6 +26,8 @@ var SumoLogicReporter = class extends WDIOReporter {
25
26
  _unsynced = [];
26
27
  _isSynchronising = false;
27
28
  _hasRunnerEnd = false;
29
+ _retryDelay = 0;
30
+ _nextRetryAt = 0;
28
31
  constructor(options) {
29
32
  super(options);
30
33
  this._options = Object.assign({
@@ -112,7 +115,7 @@ var SumoLogicReporter = class extends WDIOReporter {
112
115
  if (this._hasRunnerEnd && this._unsynced.length === 0) {
113
116
  clearInterval(this._interval);
114
117
  }
115
- if (this._isSynchronising || this._unsynced.length === 0 || typeof this._options.sourceAddress !== "string") {
118
+ if (this._isSynchronising || this._unsynced.length === 0 || typeof this._options.sourceAddress !== "string" || Date.now() < this._nextRetryAt) {
116
119
  return;
117
120
  }
118
121
  const logLines = this._unsynced.slice(0, MAX_LINES).join("\n");
@@ -123,11 +126,19 @@ var SumoLogicReporter = class extends WDIOReporter {
123
126
  method: "POST",
124
127
  body: JSON.stringify(logLines)
125
128
  });
129
+ this._retryDelay = 0;
130
+ this._nextRetryAt = 0;
126
131
  this._unsynced.splice(0, MAX_LINES);
127
- this._isSynchronising = false;
128
132
  return log.debug(`synchronised collector data, server status: ${resp.status}`);
129
133
  } catch (err) {
134
+ this._retryDelay = Math.min(
135
+ Math.max(this._options.syncInterval ?? 100, this._retryDelay * 2),
136
+ MAX_RETRY_DELAY
137
+ );
138
+ this._nextRetryAt = Date.now() + this._retryDelay;
130
139
  return log.error("failed send data to Sumo Logic:\n", err.stack);
140
+ } finally {
141
+ this._isSynchronising = false;
131
142
  }
132
143
  }
133
144
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/sumologic-reporter",
3
- "version": "9.31.2",
3
+ "version": "9.31.6",
4
4
  "description": "A WebdriverIO reporter that sends test results to Sumologic for data analyses",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-sumologic-reporter",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "514d1ea03df245adc0a2c193f74476738210f041"
46
+ "gitHead": "b18898e3c339a2bba3a6c5af46bdf0f4f897cad8"
47
47
  }