pnxtech/hydra-router

Hydra-router request timeout is not passed to Hydra Core

Closed this issue · 4 comments

The value for request timeout can be set in the config file, but when the call is created using Hydra core the options.timeout is not present so the default of 30 secs is used. However there are some processes that can take longer than 30 secs.
Am I interpreting correctly this parameter? if that is the case then when this call is done:

hydra.makeAPIRequest(msg, {timeout: this.requestTimeout})

The msg will be passed to

makeAPIRequest(message) {
return super._makeAPIRequest(message);
}

But not the timeout, so the actual value in Hydra core will be NaN therefore the value selected will be:
REQUEST_TIMEOUT = 30000;

socket.setTimeout(options.timeout * 1000 || REQUEST_TIMEOUT, () => {

cjus commented

@edcjrh You're absolutely correct. Would you like to issue a pull request or would you like us to update the makeAPIRequest(message) function signature to allow for sendOpts to be passed? This is already present in the _makeAPIRequest(message, sendOpts = { }) signature.

cjus commented

@edcjrh the fix is now available in hydra:1.6.8 and hydra-express:1.6.9 . I haven't updated Hydra-Router to use hydra.1.6.8 as we have a new hydra-router currently in test. Feel free to update your hydra-router package.json in the meantime. Thanks for pointing out this issue.

Sorry for the really late comment.
The fix works perfectly, thanks!