vtb-appit 0.0.66 → 0.0.68

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.
Files changed (2) hide show
  1. package/appit.js +21 -2
  2. package/package.json +1 -1
package/appit.js CHANGED
@@ -547,6 +547,10 @@ class Appit {
547
547
  });
548
548
  })
549
549
  });
550
+ req.on('error', error => {
551
+ console.log("IMAGE FETCH ERROR");
552
+ resolve({});
553
+ });
550
554
  req.end();
551
555
  }));
552
556
  });
@@ -581,6 +585,11 @@ class Appit {
581
585
  });
582
586
  })
583
587
  });
588
+
589
+ req.on('error', error => {
590
+ console.log("IMAGE ERROR");
591
+ resolve({});
592
+ });
584
593
 
585
594
  req.end();
586
595
  }
@@ -589,16 +598,20 @@ class Appit {
589
598
  return Promise.all(promises);
590
599
  }
591
600
 
592
- request(method, path, data)
601
+ async request(method, path, data)
593
602
  {
594
603
  const payload = (data) ? JSON.stringify(data).toString("utf8") : false;
604
+ await this.sleep(500);
595
605
 
596
606
  return new Promise((resolve, reject) => {
607
+ const agent = new https.Agent({ keepAlive: true, keepAliveMsecs: 15000 });
608
+
597
609
  const options = {
598
610
  hostname: this.hostname,
599
611
  path: pth.join(this.pathPrefix, path),
600
612
  method: method,
601
- headers: {}
613
+ headers: {},
614
+ agent: agent
602
615
  }
603
616
 
604
617
  if(payload) {
@@ -622,6 +635,8 @@ class Appit {
622
635
  try {
623
636
  resolve(JSON.parse(result))
624
637
  } catch {
638
+ console.log('ERROR');
639
+ console.log(result);
625
640
  reject(false);
626
641
  }
627
642
 
@@ -949,6 +964,10 @@ class Appit {
949
964
  {
950
965
  return await this.request('PUT', `workspaces/${workspace_id}/excursions/${this.history.excursionId}/settings`, data);
951
966
  }
967
+
968
+ sleep(delay) {
969
+ return new Promise((resolve) => setTimeout(resolve, delay))
970
+ }
952
971
  }
953
972
 
954
973
  module.exports = { Appit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtb-appit",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {