File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ Register a function `func` from example python code (the handler is formatted li
7373
7474Register a function ` func ` from example javascript code (the handler is formatted like this: $(filename) and the name of the function is "handler"):
7575
76- $ bin/serverledge-cli create -f func --memory 600 --src examples/hello.js --runtime nodejs17 --handler "hello"
77- $ bin/serverledge-cli create -f func --memory 600 --src examples/inc.js --runtime nodejs17 --handler "inc"
76+ $ bin/serverledge-cli create -f func --memory 600 --src examples/hello.js --runtime nodejs17ng --handler "hello"
77+ $ bin/serverledge-cli create -f func --memory 600 --src examples/inc.js --runtime nodejs17ng --handler "inc"
7878
7979Invoke ` func ` with arguments ` a=2 ` and ` b=3 ` :
8080
Original file line number Diff line number Diff line change @@ -140,16 +140,20 @@ func CreateOrUpdateFunction(c echo.Context) error {
140140 return err
141141 }
142142
143+ var isUpdate bool
144+
143145 if c .Path () != "/update" {
144146 _ , ok := function .GetFunction (f .Name ) // TODO: we would need a system-wide lock here...
145147 if ok {
146148 log .Printf ("Dropping request for already existing function '%s'\n " , f .Name )
147149 return c .String (http .StatusConflict , "" )
148150 }
149151
152+ isUpdate = false
150153 log .Printf ("New request: creation of %s\n " , f .Name )
151154 } else {
152155 log .Printf ("New request: creation/update of %s\n " , f .Name )
156+ isUpdate = true
153157 }
154158
155159 // Check that the selected runtime exists
@@ -182,6 +186,12 @@ func CreateOrUpdateFunction(c echo.Context) error {
182186 log .Printf ("Failed creation: %v\n " , err )
183187 return c .JSON (http .StatusServiceUnavailable , "" )
184188 }
189+
190+ if isUpdate {
191+ // terminate any warm container after the update
192+ node .ShutdownWarmContainersFor (& f )
193+ }
194+
185195 response := struct { Created string }{f .Name }
186196 return c .JSON (http .StatusOK , response )
187197}
You can’t perform that action at this time.
0 commit comments