-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeout callback #77
Comments
@glenarama - Let me check.... I am pretty sure I had to take out the timeout code or option since tls.connect does this by default. I had to remove and move around how things work. The only difference between the TLS and non-TLS connect is just it having to use certificates to connect and the timeout on non-TLS does work. |
Im ok with the default timeout actually - but I can't seem to capture the timeout event. It isn't thrown as an error. |
The timeout event has been elusive to me as well... I think I had to get rid of it cause the timeout happens and then the error event kicked in. Originally I was overriding "error". emit on the socket, causing some issues that you reported before so I had to re-write it to no folow that format.... Use the:
Event. It should capture a timeout. |
Do we need something like the below on the connection client to throw it?
|
I had that at one point... didn't quite seem to do anything cause by the time i try to do a "retry", timeout event is not thrown. I think that might be the issue cause I am forcing the socket to skip that in a way. I can see if putting it back in works and through it against the server (which I created a docker instance to do testing and the corepoint server) to see if it throws, but since I built int he auto-reconnect, it might not fire. |
Yeah, so..
This is from Node Docs. Timeout is idle, not connection. I had a connectionTimer in there but it was being messed up. I can see if I can add it back end to send client.timeout event vs. 'timeout' |
Yes ideal workflow for me would be: Connect -> [Timeout OR Error] -> Retry until count -> Emit Timeout or Error message -> Exit |
Ok. I think the min. timeout will have to be 10 seconds cause in 99.6% of the time connection will happen right away. This way as well I can create a proper unit test without having to override the defaults. |
@glenarama Ok.. check this out updated unit test: From adding this: That will fire 'client.timeout' in this case in about 1 second. The console would be gone, but ECONNREFUSED which was already being captures in this unit test from client.error works. client.timeout just says, yep, we tried again and if you wanted the error, check on client.error event for what really happened. |
Fixed in #83 |
Utilising a TLS connection i don't appear to get any timeout callback/error.
Looking at the code, I don't on timeout and wondered if/how it was handled?
Thanks!
The text was updated successfully, but these errors were encountered: