Closed c0ze closed 6 years ago
@kunihiko-t @vasilev
Thanks ! Yes I am looking at providing some test coverage. Might take a while !
@kunihiko-t @vasilev
I added tests for setting idle_timeout
(and every other param) from fn tool ! I would appreciate if you could take a look !
Regarding the test I posted go code above, it actually tests hot functions spin down behaviour, which is beyond the scope of this PR. This PR only deals with setting idle_timeout
from fn tool.
I'm checking your hotfunction example and trying to make it running on my environment. (https://github.com/iron-io/functions/tree/master/examples/hotfunctions/http) But it seems the idle_timeout is not possible setting from fn cmd. I set it in func.yaml ( ex: idle_timeout:30 ) , and inpect it using fn routes inspect. But it always get 0.
And find this post , it seems you guys are working on it . Let me know when there's a patch of fn cmd. And will be really nice if user can set on function-ui.
Just let you guys know my result. Thanks again.
@sss0350 Thanks for the response !
Yes, this is actually ready to go, so setting idle_timeout
from fn will be available in a few moments. (it will be version 0.2.72
, so dont forget to update !)
Regarding UI, we already added it but it is not released yet. We will combine a couple of feature requests for UI and release a new version soon (hopefully in a couple of weeks) !
I just get it a quick try this afternoon at my office, I can set idle_timeout from cmd.
And trigger your hot function examples ( https://github.com/iron-io/functions/tree/master/examples/hotfunctions/http ), but find the containers still not keep alive within 30s. After trigger function , and I check this hot function container thru docker ps | grep myfnname , it seems this container still be killed immediately after trigger. It should be alive within 30s , right? Did I misunderstand anything here? Or any other steps should be done to make a hotfunction?
Yes, it should be alive for the duration of idle timeout. You can see if it's being killed in the server logs. Can you see anything there?
It seems fn tool doesn't support setting
idle_timeout
param for hot function routes.https://github.com/iron-io/functions/blob/master/docs/function-timeouts.md https://github.com/iron-io/functions/blob/master/docs/hot-functions.md
To test, create an app, and a route with :
modify hot-functions func.go to look something like :
to keep a passed value, and print both when there is a request. Then you can call the function with :
You should see previous call in the second call output.
after a while, you should see the hot func spin down in the service logs
without this patch (and setting
idle_timeout
) the function spins down immediately after serving the response.