Refactoring for testing
This commit is contained in:
parent
4a3b5379b9
commit
b231629e37
@ -7,6 +7,7 @@ import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
)
|
||||
|
||||
@ -19,8 +20,14 @@ func startpprof() {
|
||||
logFatal.Fatal(http.ListenAndServe("127.0.0.1:7777", nil))
|
||||
}
|
||||
|
||||
func statusReport() {
|
||||
func statusReportHandler() {
|
||||
for {
|
||||
StatusReport()
|
||||
time.Sleep(time.Second * 60)
|
||||
}
|
||||
}
|
||||
|
||||
func StatusReport() {
|
||||
running := 0
|
||||
keepalive := 0
|
||||
unsupported := 0
|
||||
@ -34,7 +41,7 @@ func statusReport() {
|
||||
running = running + 1
|
||||
} else if o.Status == 607 { // Keepalive
|
||||
keepalive = keepalive + 1
|
||||
} else if o.Status == 605 {// Unsupported instance
|
||||
} else if o.Status == 605 { // Unsupported instance
|
||||
unsupported = unsupported + 1
|
||||
}
|
||||
|
||||
@ -47,9 +54,7 @@ func statusReport() {
|
||||
}
|
||||
}
|
||||
ri_mutex.Unlock()
|
||||
logInfo("Running:",running," Keepalive:", keepalive, " Unsupported:", unsupported, " M:", mastodon, ",P:",pleroma,",O:",other)
|
||||
time.Sleep(time.Second*60)
|
||||
}
|
||||
logInfo("Running:", running, " Keepalive:", keepalive, " Unsupported:", unsupported, " M:", mastodon, ",P:", pleroma, ",O:", other)
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -83,7 +88,7 @@ func main() {
|
||||
|
||||
go startctl()
|
||||
//go webmain()
|
||||
go statusReport()
|
||||
go statusReportHandler()
|
||||
|
||||
runtime.Goexit()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user