Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit 5cabf3e

Browse files
authored
Merge pull request #2 from ForestCrazy/dev
Dev
2 parents fa5348e + cf93032 commit 5cabf3e

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ build/
143143
.history
144144
.ionide
145145

146-
fetch_node_list.py
147-
148146
# End of https://www.toptal.com/developers/gitignore/api/node,visualstudiocode
149-
fetch_node_list.py
147+
node_list.txt
148+
fetch_node_list.py

index.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const { combine, timestamp, label, printf } = format;
4343
databaseURL: "https://chia-controller-75c1e.firebaseio.com", // Realtime Database
4444
});
4545
var while_loop_round = 0;
46+
var setting = {
47+
firestore: 10,
48+
node_length: 20
49+
}
4650
while (true) {
4751
var resource_node_list = null;
4852
const node_list_file = 'node_list.txt';
@@ -61,12 +65,30 @@ const { combine, timestamp, label, printf } = format;
6165
} else {
6266
logger.info('import node list from firestore database');
6367
resource_node_list = 'node_list_firebase';
64-
if (while_loop_round % 10 == 0) {
68+
if (while_loop_round % setting.firestore == 0) {
6569
const firestore_node_list = await app.firestore().collection('node_list').get();
6670
var node_obj = firestore_node_list.docs.map(doc => doc.data());
6771
}
6872
}
6973

74+
const node_list_length = Object.keys(node_obj).length;
75+
if (node_list_length <= 10) {
76+
setting = {
77+
firestore: 10,
78+
node_length: 100
79+
}
80+
} else if (node_list_length <= 100) {
81+
setting = {
82+
firestore: 10,
83+
node_length: 10
84+
}
85+
} else {
86+
setting = {
87+
firestore: 1,
88+
node_length: 1
89+
}
90+
}
91+
7092
const currConnections = await fullNode.getConnections();
7193
const currConn_obj = JSON.parse(JSON.stringify(currConnections))['connections'];
7294

@@ -100,7 +122,7 @@ const { combine, timestamp, label, printf } = format;
100122
}
101123
}
102124

103-
if (while_loop_round % 100 == 0 && while_loop_round !== 0) {
125+
if (while_loop_round % setting.node_length == 0) {
104126
if (resource_node_list !== 'node_list_firebase') {
105127
var node_obj = await app.firestore().collection('node_list').get();
106128
node_obj = node_obj.docs.map(doc => doc.data());

node_list.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,15 @@ node-apne.chia.net:8444
250250
185.219.178.187:8444
251251
60.208.131.142:8444
252252
24.133.65.187:8444
253-
171.5.48.96:8444
253+
171.5.48.96:8444
254+
98.197.0.72:8444
255+
78.37.41.172:8444
256+
27.17.174.40:8444
257+
24.29.172.8:8444
258+
1.200.170.0:8444
259+
36.5.46.159:8444
260+
189.6.20.21:8444
261+
89.1.28.186:8444
262+
1.20.34.21:8444
263+
58.41.3.175:8444
264+
5.173.13.69:8444

0 commit comments

Comments
 (0)