Hello Adis,

We could certainly add another API/Lua function but it might be easier to
change

luaL_checkinteger(L, 2) in

 tmout = MAY_LJMP(luaL_checkinteger(L, 2)) * 1000;

to  luaL_checknumber(L, 2), along with appropriate cast to int.

Then we have backwards compatibility, less documentation to write, and get
millisecond timeouts.

If people want a separate API, I'm happy to do that too, just more work.


Please advise, and I'll make a patch either way.  I'm unfamiliar with the
HAProxy development process, so any tips or pointers are welcome,


thanks all!


nickg

On Wed, Nov 8, 2017 at 12:45 AM, Adis Nezirovic <[email protected]>
wrote:

> On 11/07/2017 08:49 PM, Nick Galbreath wrote:
> > I have a question regarding the socket:settimeout function.
> >
> > It appears to only accept an integer value for seconds, but internally
> > converts to milliseconds (see below).
> >
> > Is there a reason to enforce whole seconds, or could this be relaxed to
> > accept a lua number (float/double).?
>
> Hi Nick,
>
> HAProxy uses Lua 5.3 which has proper integers. There is already a
> similar situation where we have both, seconds and milliseconds
> (hlua_sleep/hlua_msleep), so maybe that's the best solution here too,
> just add another variant using milliseconds.
>
> Best regards,
> Adis
>



-- 
Nick Galbreath  | Founder / CTO          | @ngalbreath     |
Signal Sciences | www.signalsciences.com | @signalsciences |

Reply via email to