diff --git a/fedilogue/fedilogue.go b/fedilogue/fedilogue.go index 5c09eb2..6582a09 100644 --- a/fedilogue/fedilogue.go +++ b/fedilogue/fedilogue.go @@ -8,6 +8,7 @@ import ( "regexp" "runtime" "sync" + "time" ) // Current instances @@ -20,6 +21,37 @@ func startpprof() { logFatal.Fatal(http.ListenAndServe("127.0.0.1:7777", nil)) } +func statusReport() { + for { + running := 0 + keepalive := 0 + unsupported := 0 + + mastodon := 0 + pleroma := 0 + other := 0 + for _, o := range runninginstances { + if o.Status == 200 { + running = running + 1 + } else if o.Status == 607 { // Keepalive + keepalive = keepalive + 1 + } else if o.Status == 605 {// Unsupported instance + unsupported = unsupported + 1 + } + + if o.Software == "mastodon" && o.Status == 200 { + mastodon = mastodon + 1 + } else if o.Software == "pleroma" && o.Status == 200 { + pleroma = pleroma + 1 + } else if o.Status == 200 { + other = other + 1 + } + } + logInfo("Running:",running," Keepalive:", keepalive, " Unsupported:", unsupported, " M:", mastodon, ",P:",pleroma,",O:",other) + time.Sleep(time.Second*60) + } +} + func main() { // Initial Setup logInit() @@ -50,7 +82,8 @@ func main() { } go startctl() - go webmain() + //go webmain() + go statusReport() runtime.Goexit() } diff --git a/fedilogue/instance.go b/fedilogue/instance.go index ccb5a46..b279d49 100644 --- a/fedilogue/instance.go +++ b/fedilogue/instance.go @@ -192,10 +192,6 @@ func StartInstance(endpoint string) { o = GetNodeInfo(endpoint, o) UpdateRunner(endpoint, o) - if o.Software == "" { - return - } - if o.Software == "pleroma" { logConn("Starting " + endpoint + " as " + o.Software + " " + o.Version) o.CaptureType = "Poll" @@ -207,6 +203,8 @@ func StartInstance(endpoint string) { UpdateRunner(endpoint, o) StreamMastodon(endpoint, &o) } else { + o.Status = 605 + UpdateRunner(endpoint, o) logConn("Unsupported endpoint " + endpoint) } }