Refactoring for testing

This commit is contained in:
Farhan Khan 2021-08-07 19:46:35 +00:00
parent 4a3b5379b9
commit b231629e37

View File

@ -7,6 +7,7 @@ import (
"runtime" "runtime"
"sync" "sync"
"time" "time"
"github.com/microcosm-cc/bluemonday" "github.com/microcosm-cc/bluemonday"
) )
@ -19,8 +20,14 @@ func startpprof() {
logFatal.Fatal(http.ListenAndServe("127.0.0.1:7777", nil)) logFatal.Fatal(http.ListenAndServe("127.0.0.1:7777", nil))
} }
func statusReport() { func statusReportHandler() {
for { for {
StatusReport()
time.Sleep(time.Second * 60)
}
}
func StatusReport() {
running := 0 running := 0
keepalive := 0 keepalive := 0
unsupported := 0 unsupported := 0
@ -48,8 +55,6 @@ func statusReport() {
} }
ri_mutex.Unlock() ri_mutex.Unlock()
logInfo("Running:", running, " Keepalive:", keepalive, " Unsupported:", unsupported, " M:", mastodon, ",P:", pleroma, ",O:", other) logInfo("Running:", running, " Keepalive:", keepalive, " Unsupported:", unsupported, " M:", mastodon, ",P:", pleroma, ",O:", other)
time.Sleep(time.Second*60)
}
} }
func main() { func main() {
@ -83,7 +88,7 @@ func main() {
go startctl() go startctl()
//go webmain() //go webmain()
go statusReport() go statusReportHandler()
runtime.Goexit() runtime.Goexit()
} }