Use latest version of function for watches
This commit is contained in:
@@ -21,5 +21,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func UrlForFunction(m *Metadata) string {
|
func UrlForFunction(m *Metadata) string {
|
||||||
return fmt.Sprintf("/fission-function/%v/%v", m.Name, m.Uid)
|
prefix := "/fission-function"
|
||||||
|
if len(m.Uid) > 0 {
|
||||||
|
return fmt.Sprintf("%v/%v/%v", prefix, m.Name, m.Uid)
|
||||||
|
} else {
|
||||||
|
return fmt.Sprintf("%v/%v", prefix, m.Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,13 +56,7 @@ func (api *API) WatchApiCreate(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
function, err := api.FunctionStore.Get(&watch.Function)
|
watch.Url = fission.UrlForFunction(&watch.Function)
|
||||||
if err != nil {
|
|
||||||
api.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
watch.Url = fission.UrlForFunction(&function.Metadata)
|
|
||||||
|
|
||||||
uid, err := api.WatchStore.Create(&watch)
|
uid, err := api.WatchStore.Create(&watch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func (ts *HTTPTriggerSet) getRouter() *mux.Router {
|
|||||||
for _, function := range ts.functions {
|
for _, function := range ts.functions {
|
||||||
fh := &functionHandler{
|
fh := &functionHandler{
|
||||||
fmap: ts.functionServiceMap,
|
fmap: ts.functionServiceMap,
|
||||||
Function: function.Metadata,
|
Function: fission.Metadata{Name: function.Metadata.Name},
|
||||||
poolmgr: ts.poolmgr,
|
poolmgr: ts.poolmgr,
|
||||||
}
|
}
|
||||||
muxRouter.HandleFunc(fission.UrlForFunction(&function.Metadata),
|
muxRouter.HandleFunc(fission.UrlForFunction(&function.Metadata),
|
||||||
|
|||||||
Reference in New Issue
Block a user