Browse Source

Configurable refresh

Loweel 4 years ago
parent
commit
b7f084ae3d
2 changed files with 6 additions and 4 deletions
  1. 1 4
      main.go
  2. 5 0
      matrix.go

+ 1 - 4
main.go

@@ -37,10 +37,7 @@ func main() {
 	}
 	log.Println("Minimum request to learn: ", Maturity)
 
-	ProxyFlow.refreshtime, err = time.ParseDuration(os.Getenv("REFRESHTIME"))
-	if err != nil {
-		ProxyFlow.refreshtime = time.Duration(48 * time.Hour)
-	}
+	
 
 	proxy := httputil.NewSingleHostReverseProxy(remote)
 	http.HandleFunc("/", handler(proxy))

+ 5 - 0
matrix.go

@@ -246,6 +246,11 @@ func (c *ByClassifier) readStatsTokens() {
 //CleanMEH cleans periodically the spurious tokens.
 func (c *ByClassifier) CleanMEH() {
 
+	ProxyFlow.refreshtime, err = time.ParseDuration(os.Getenv("REFRESHTIME"))
+	if err != nil {
+		ProxyFlow.refreshtime = time.Duration(48 * time.Hour)
+	}
+
 	log.Println("Clean MEH Thread running each: ", ProxyFlow.refreshtime)
 
 	for a := range time.Tick(ProxyFlow.refreshtime) {