fedilogue/poll/main.go

34 lines
593 B
Go

package main
import (
_ "net/http/pprof"
"net/http"
"sync"
"log"
)
// Current instances
var runninginstances map[string]RunningInstance
var ri_mutex = &sync.Mutex{}
func startpprof() {
log.Print("Starting http/pprof on :7777")
log.Fatal(http.ListenAndServe("127.0.0.1:7777", nil))
}
func main() {
// Initial Setup
reportPostChan := make(chan ReportPost)
runninginstances = make(map[string]RunningInstance)
go startpprof()
pool := get_db_pool()
go startctl(reportPostChan)
go webmain(reportPostChan)
for { // Write posts
v := <-reportPostChan
go writePost(pool, v)
}
}