Fix creation of redundant pods on heavy load cold start (#232)
Modifies function specialization so that concurrent requests for the same function cause only one pod to be created.
This commit is contained in:
@@ -45,9 +45,12 @@ func (fmap *functionServiceMap) lookup(f *fission.Metadata) (*url.URL, error) {
|
||||
}
|
||||
|
||||
func (fmap *functionServiceMap) assign(f *fission.Metadata, serviceUrl *url.URL) {
|
||||
err, _ := fmap.cache.Set(*f, serviceUrl)
|
||||
err, old := fmap.cache.Set(*f, serviceUrl)
|
||||
if err != nil {
|
||||
log.Printf("error caching service url for function: %v", err)
|
||||
if *serviceUrl == *(old.(*url.URL)) {
|
||||
return
|
||||
}
|
||||
log.Printf("error caching service url for function with a different value: %v", err)
|
||||
// ignore error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user