fedilogue/poll/main.go

34 lines
593 B
Go
Raw Normal View History

package main
import (
_ "net/http/pprof"
"net/http"
"sync"
"log"
)
// Current instances
var runninginstances map[string]RunningInstance
var ri_mutex = &sync.Mutex{}
2020-11-24 20:36:47 -05:00
func startpprof() {
log.Print("Starting http/pprof on :7777")
log.Fatal(http.ListenAndServe("127.0.0.1:7777", nil))
}
2020-11-24 20:36:47 -05:00
func main() {
// Initial Setup
2020-11-16 00:10:33 -05:00
reportPostChan := make(chan ReportPost)
2020-11-24 20:36:47 -05:00
runninginstances = make(map[string]RunningInstance)
2020-11-24 20:36:47 -05:00
go startpprof()
2020-11-16 00:10:33 -05:00
2020-11-24 20:36:47 -05:00
pool := get_db_pool()
go startctl(reportPostChan)
go webmain(reportPostChan)
for { // Write posts
v := <-reportPostChan
2020-11-17 22:35:59 -05:00
go writePost(pool, v)
}
}