From 9bd586ce611d9fefe02a94cee55b6d5c9ee5a9ff Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Thu, 1 Sep 2016 14:34:33 -0700 Subject: [PATCH] Include PoolManager URL in function handler state and initializer --- src/router/functionHandler.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/router/functionHandler.go b/src/router/functionHandler.go index 791c4c51..325b7ed3 100644 --- a/src/router/functionHandler.go +++ b/src/router/functionHandler.go @@ -26,10 +26,11 @@ import ( type functionHandler struct { fmap *functionServiceMap + poolManagerUrl string function } -func getService(f *function) (*url.URL, error) { +func (*functionHandler) getServiceForFunction() (*url.URL, error) { return nil, errors.New("not implemented") } @@ -37,7 +38,7 @@ func (fh *functionHandler) handler(responseWriter http.ResponseWriter, request * serviceUrl, err := fh.fmap.lookup(&fh.function) if (err != nil) { // Cache miss: request the Pool Manager to make a new service. - serviceUrl, poolErr := getService(&fh.function) + serviceUrl, poolErr := fh.getServiceForFunction() if (poolErr != nil) { // now we're really screwed log.Printf("Failed to get service for function (%v,%v): %v", @@ -67,4 +68,6 @@ func (fh *functionHandler) handler(responseWriter http.ResponseWriter, request * } proxy := &httputil.ReverseProxy{Director: director} proxy.ServeHTTP(responseWriter, request) + + // TODO: handle failures and possibly retry here. }