Skip to content

Error callback calls twice if host is inaccessible #106

@xaratt

Description

@xaratt

Hi,
if server is not available error callback will be called twice: first time after TIMEOUT and second time later. I return response to user in error callback, so in this case response will be returned twice.

Script example: http://pastebin.com/X1d8j0S9
Run and open in browser http://localhost:8888/ :

user@localhost ~ $ node es.js
Listen...
ERROR [Error: timed out after 5000ms]  <-- timeout is 5s
ERROR { [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect' }  <--  ~30s later when socket was closed (?)

I tried abort the request before emitting timeout error (elasticSearchCall.js:50), but second error still raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions