Closed bmcustodio closed 5 years ago
Hi Bruno
Thanks for your contribution.
We need to be backwards compatible with integer format.
Please see how this is done in the openfaas-incubator/of-watchdog or openfaas/faas/watchdog and copy the approach.
Regards,
Alex
Hi @alexellis,
Thanks for reviewing!
We need to be backwards compatible with integer format. Please see how this is done in the openfaas-incubator/of-watchdog or openfaas/faas/watchdog and copy the approach.
Are you referring to this function? If that is the case, I'd like to point out that, IMHO, that function has a few problems: it is neither compatible with integer values (as is being requested), nor is the default value observed properly whenever an environment variable cannot be parsed as a duration. I have put together an example here.
I will happily amend my commits in order to address your request, but I don't really feel like copying from https://github.com/openfaas-incubator/of-watchdog is the best approach. 🙂 Thoughts?
In my comment, I asked you to look at both watchdogs.
Here's the code that I mean https://github.com/openfaas/faas/blob/master/watchdog/readconfig.go#L31
If it's not part of the of-watchdog
codebase, then perhaps it should be, because we still have some users and old blogs / tutorial (that cannot be changed) that prescribe timeout values without a Golang duration added i.e. 60
-> 60s
.
Does this make sense?
but I don't really feel like copying from X
Why?
Thanks for your comment. I've updated the code and raised an issue for the discrepancy you found in how of-watchdog parses user-supplied durations. Please feel free to work on the issue linked above. https://github.com/openfaas-incubator/of-watchdog/issues/64
Hi @bmcstdio, I was under the impression from @ewilde that this was urgently needed. Please let us know if your issue has been addressed and works as expected.
https://github.com/openfaas-incubator/golang-http-template/pull/22#issuecomment-501794638
See comment above for contributing the fix to the other issue you found whilst investigating the solution.
Cheers,
Alex
@alexellis it was indeed urgently needed - fortunately #23 fixed the problem, so thank you very much for that.
Description
Allows for setting the read and write timeouts using the
read_timeout
andwrite_timeout
environment variables.Closes #9.
How Has This Been Tested?
I've tested this by setting the aforementioned values to
10s
(hence more than the default of3s
) and executing a piece of code that takes a while to complete:Before this change, I would get something like the following:
How are existing users impacted? What migration steps/scripts do we need?
I am not really sure, since I am fairly new to OpenFAAS.
Checklist:
I have:
git commit -s