pinokiod 3.8.67 → 3.8.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/kernel/peer.js +13 -6
  2. package/package.json +1 -1
package/kernel/peer.js CHANGED
@@ -35,10 +35,15 @@ class PeerDiscovery {
35
35
  }, this.interval);
36
36
  });
37
37
  }
38
- _refresh(host) {
39
- return axios.get(`http://${host}:${this.default_port}/pinokio/peer`).then((res) => {
38
+ async _refresh(host) {
39
+ try {
40
+ let res = await axios.get(`http://${host}:${this.default_port}/pinokio/peer`, {
41
+ timeout: 2000
42
+ })
40
43
  return res.data
41
- })
44
+ } catch (e) {
45
+ return null
46
+ }
42
47
  }
43
48
  async refresh() {
44
49
  this.info = {}
@@ -48,9 +53,11 @@ class PeerDiscovery {
48
53
  console.log({ peer_info })
49
54
  for(let i=0; i<peer_info.length; i++) {
50
55
  let peer = peer_info[i]
51
- this.info[peer.host] = {
52
- host: peer.host,
53
- ...peer_info[i],
56
+ if (peer) {
57
+ this.info[peer.host] = {
58
+ host: peer.host,
59
+ ...peer
60
+ }
54
61
  }
55
62
  }
56
63
  console.log("REFRESH", this.info)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.67",
3
+ "version": "3.8.68",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {