-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.go
40 lines (38 loc) · 932 Bytes
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package farmer
import (
"github.com/goarchit/archit/log"
"encoding/json"
"strconv"
)
func Status() string {
walletCmd <- "status"
response := <-walletCmd
response += "\n"+strconv.Itoa(len(PeerMap.PL))+" Peers: [ "
count := 0
for _, v := range PeerMap.PL {
count++
// Limit screen output
if count > 100 {
response += "..."
break
}
response += v.IPAddr + " "
}
response += "]\n\nInternal RPC Stats: "
s, err := json.Marshal(intCmd.Stats)
if err != nil {
log.Critical("Farmer status() error Marshaling intCmd.Stats")
}
response += string(s)+"\n"
response += "\nExternal RPC Stats: "
s, err = json.Marshal(extCmd.Stats)
if err != nil {
log.Critical("Farmer status() error Marshaling extCmd.Stats")
}
response += string(s)+"\n"
response += "]\n\nDatabase statuses since last open:\n"
dbCmd <- "status"
response += <-dbCmd
log.Info("Farmer Status returning:\n", response)
return response
}