@defillama/sdk 5.0.246 → 5.0.249

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.
@@ -22,21 +22,21 @@ function getClient() {
22
22
  if (!envString)
23
23
  return;
24
24
  config = JSON.parse(envString.replace(/\\"/g, '"')); // replace escaped quotes
25
+ if (!_client)
26
+ _client = new elasticsearch_1.Client({
27
+ maxRetries: 3,
28
+ requestTimeout: 5000,
29
+ compression: true,
30
+ node: config.host,
31
+ auth: {
32
+ username: config.username,
33
+ password: config.password,
34
+ },
35
+ });
25
36
  }
26
37
  catch (error) {
27
38
  return;
28
39
  }
29
- if (!_client)
30
- _client = new elasticsearch_1.Client({
31
- maxRetries: 3,
32
- requestTimeout: 5000,
33
- compression: true,
34
- node: config.host,
35
- auth: {
36
- username: config.username,
37
- password: config.password,
38
- },
39
- });
40
40
  return _client;
41
41
  }
42
42
  async function writeLog(index, log) {
@@ -122,10 +122,8 @@ async function reportIssues(issues, { limitMs = 50000 } = {}) {
122
122
  console.warn('Elasticsearch client not configured, skipping reportIssues');
123
123
  return;
124
124
  }
125
- const cutoff = (0, exports.dayOf)(Date.now() / 1000 - 7 * 86400); // a check can find old items again on each run
126
125
  const timestamp = +Date.now();
127
126
  const docs = issues
128
- .filter((i) => !i.day || i.day >= cutoff)
129
127
  .map(({ value, baseline, ...issue }) => ({ ...issue, value, baseline, timestamp, deviation: value != null && baseline ? (value - baseline) / baseline : null }));
130
128
  if (!docs.length)
131
129
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "5.0.246",
3
+ "version": "5.0.249",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {