tomas / tomas/needle

open_timeout seems to be blocking

Open
#320 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

I've got a needle request to a service that sometimes takes a long time to respond, occasionally exceeding the open_timeout limit of 10 seconds. However, when it does so, no error is thrown, and the program seems to block on this line:

needle.defaults({
    open_timeout: 10000,
});
let response;
try{
    response = await needle('get', requestUrl, await this.getAuthHeaders());
    console.log("await completed");
}catch(err){
    console.error(err);
}

if open_timeout is triggered, Chrome reports that the connection was cancelled, but neither the console.log statement nor the console.error statement are triggered. Am I missing some other method of handling this timeout, or is this a bug?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided async needle request with a response that exceeds the 10-second open_timeout, then trace how the timeout is handled. Done means the request promise settles predictably and either the response or an error is observable, with a regression test covering the timeout case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.