@steerprotocol/data-connector-loader 0.0.8 → 0.0.10

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/lib/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare class DataConnectorExecution {
5
5
  private delay;
6
6
  private log;
7
7
  private fetchData;
8
+ private exponentialBackoffDelay;
8
9
  execute<T>(vaultAddress: string, _vaultConfig: string): Promise<Array<T>>;
9
10
  private downloadWasmBundle;
10
11
  }
package/lib/index.js CHANGED
@@ -36,6 +36,7 @@ class DataConnectorExecution {
36
36
  this.log('API Response: =============', response);
37
37
  if ('errors' in response && response['errors'].length > 0) {
38
38
  if (attempts < 3) {
39
+ yield this.delay(this.exponentialBackoffDelay(attempts));
39
40
  return yield this.fetchData(request, attempts);
40
41
  }
41
42
  else {
@@ -46,6 +47,7 @@ class DataConnectorExecution {
46
47
  }
47
48
  catch (error) {
48
49
  if (attempts < 3) {
50
+ yield this.delay(this.exponentialBackoffDelay(attempts));
49
51
  return yield this.fetchData(request, attempts);
50
52
  }
51
53
  else {
@@ -54,6 +56,12 @@ class DataConnectorExecution {
54
56
  }
55
57
  });
56
58
  }
59
+ exponentialBackoffDelay(attempts) {
60
+ const baseDelay = 1000; // 1 second
61
+ const maxDelay = 30000; // 30 seconds
62
+ const delay = Math.min(baseDelay * Math.pow(2, attempts - 1), maxDelay);
63
+ return delay;
64
+ }
57
65
  execute(vaultAddress, _vaultConfig) {
58
66
  return __awaiter(this, void 0, void 0, function* () {
59
67
  const executionTimestamp = new Date().getTime();
@@ -20,7 +20,7 @@ class PluginManager {
20
20
  }
21
21
  registerFromPublicConfig() {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
- const { data: dataConnectorPlugins } = yield axios_1.default.get('https://igk02ovpui.execute-api.us-east-1.amazonaws.com/data-connector-plugins');
23
+ const { data: dataConnectorPlugins } = yield axios_1.default.get('https://ro81h8hq6b.execute-api.us-east-1.amazonaws.com/data-connector-plugins');
24
24
  for (const plugin of dataConnectorPlugins) {
25
25
  this.registerPluginConfig(plugin.name, plugin.domain, plugin.headers);
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerprotocol/data-connector-loader",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "App Loader for Steer Protocol",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",