From d474d98f845461aa8d05c62bab0f64add823b9b2 Mon Sep 17 00:00:00 2001 From: Farhan Khan Date: Thu, 3 Dec 2020 17:26:38 -0500 Subject: [PATCH] Gets the settings, whoopsie on the order of commits --- poll/main.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/poll/main.go b/poll/main.go index 788be7e..b33f8ae 100644 --- a/poll/main.go +++ b/poll/main.go @@ -21,10 +21,27 @@ func main() { reportPostChan := make(chan ReportPost) runninginstances = make(map[string]RunningInstance) + getSettings() go startpprof() pool := get_db_pool() + + go startctl(reportPostChan) + + for _, endpoint := range settings.Autostart { + log.Print("Autostarting " + endpoint) + ri_mutex.Lock() + _, exists := runninginstances[endpoint] + if exists == true { + log.Println("Already exists: " + endpoint) + } else { + runninginstances[endpoint] = RunningInstance{} + go StartInstance(endpoint, reportPostChan) + } + ri_mutex.Unlock() + } + go webmain(reportPostChan) for { // Write posts v := <-reportPostChan