mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	middleware/proxy: async health checks (#749)
* Switches out Unhealthy bool for OkUntil timestamp * Make sure servers are healthy forever if there are no health checks * Moves health check off into a go routine to avoid blocking conditions * Improved logging info * Fixes initial date * Fixes health checking; alters tests to adapt to async health checking * Moves future variable into static upstream and populates it in more places * Restores silencing of stdout during testing * Restores silencing of stdout during testing * keeps check url string once built * Removes debug message * uses zero value to signal no checking; reduces in-mutex code to a fetch
This commit is contained in:
		| @@ -5,6 +5,7 @@ import ( | ||||
| 	"net/http/httptest" | ||||
| 	"os" | ||||
| 	"testing" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| var workableServer *httptest.Server | ||||
| @@ -54,7 +55,7 @@ func TestRoundRobinPolicy(t *testing.T) { | ||||
| 		t.Error("Expected second round robin host to be third host in the pool.") | ||||
| 	} | ||||
| 	// mark host as down | ||||
| 	pool[0].Unhealthy = true | ||||
| 	pool[0].OkUntil = time.Unix(0, 0) | ||||
| 	h = rrPolicy.Select(pool) | ||||
| 	if h != pool[1] { | ||||
| 		t.Error("Expected third round robin host to be first host in the pool.") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user