pinokiod 3.8.86 → 3.8.87

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 +18 -3
  2. package/package.json +1 -1
package/kernel/peer.js CHANGED
@@ -39,6 +39,15 @@ class PeerDiscovery {
39
39
  setInterval(() => {
40
40
  console.log("send message to peers")
41
41
  this.socket.send(this.message, 0, this.message.length, this.port, '255.255.255.255');
42
+
43
+ // if peer exists but info doesn't exist, refresh
44
+ for(let peer of this.peers) {
45
+ if (!this.info[peer]) {
46
+ // retrying
47
+ console.log("retrying for peer", peer)
48
+ this.refresh([peer])
49
+ }
50
+ }
42
51
  }, this.interval);
43
52
  });
44
53
  }
@@ -71,9 +80,15 @@ class PeerDiscovery {
71
80
  return res
72
81
  }
73
82
  // refresh peer info
74
- async refresh() {
75
- this.info = {}
76
- let peer_info = await Promise.all(Array.from(this.peers).map((host) => {
83
+ async refresh(peers) {
84
+ let refresh_peers
85
+ if (peers) {
86
+ refresh_peers = peers
87
+ } else {
88
+ this.info = {}
89
+ refresh_peers = Array.from(this.peers)
90
+ }
91
+ let peer_info = await Promise.all(refresh_peers.map((host) => {
77
92
  return this._refresh(host)
78
93
  }))
79
94
  console.log({ peer_info })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.86",
3
+ "version": "3.8.87",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {