Refactoring for testing
This commit is contained in:
parent
4a3b5379b9
commit
b231629e37
@ -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
|
||||||
@ -34,7 +41,7 @@ func statusReport() {
|
|||||||
running = running + 1
|
running = running + 1
|
||||||
} else if o.Status == 607 { // Keepalive
|
} else if o.Status == 607 { // Keepalive
|
||||||
keepalive = keepalive + 1
|
keepalive = keepalive + 1
|
||||||
} else if o.Status == 605 {// Unsupported instance
|
} else if o.Status == 605 { // Unsupported instance
|
||||||
unsupported = unsupported + 1
|
unsupported = unsupported + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,9 +54,7 @@ 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()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user