Fix executor tries to create a new deployment when a function is updated (#524)

Newdeploy manager now checks the existence of function service cache by function UID before trying to create a new deployment. And return the cached fsvc directly if the cache exists.
This commit is contained in:
Ta-Ching Chen
2018-03-08 02:52:36 +08:00
committed by GitHub
parent a3826046a5
commit b4300feabc
7 changed files with 169 additions and 45 deletions
@@ -70,6 +70,11 @@ func TestFunctionServiceCache(t *testing.T) {
fsc.Log()
log.Panicf("Failed to get fsvc: %v", err)
}
f, err = fsc.GetByFunctionUID(fsvc.Function.UID)
if err != nil {
fsc.Log()
log.Panicf("Failed to get fsvc by function uid: %v", err)
}
fsvc.Atime = f.Atime
fsvc.Ctime = f.Ctime
if f.Address != fsvc.Address {
@@ -98,4 +103,10 @@ func TestFunctionServiceCache(t *testing.T) {
fsc.Log()
log.Panicf("found fsvc while expecting empty cache: %v", err)
}
_, err = fsc.GetByFunctionUID(fsvc.Function.UID)
if err == nil {
fsc.Log()
log.Panicf("found fsvc by function uid while expecting empty cache: %v", err)
}
}