Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Client is not attempting reconnect #3

Closed
ethul opened this issue Jan 27, 2016 · 4 comments
Closed

Client is not attempting reconnect #3

ethul opened this issue Jan 27, 2016 · 4 comments

Comments

@ethul
Copy link

ethul commented Jan 27, 2016

The disque client looks to have reconnect functionality built in. However, I am having trouble getting the client to reconnect to the disque server.

My test scenario is that I first create a disque client and shortly afterwards shutdown the disque server. I expected that when I brought the server back up, the client would eventually reconnect. From my test, the client remains in the ended state and will not reconnect. If I trace through what the client is doing, it looks to be skipping the reconnect attempts because it returns due to ended being true.

Between 2690766...05146ea the ended property is now set to true when the socket's close event is fired due to the call to tryRemove. Any pointers for how to get this working would be very much appreciated.

@zensh
Copy link
Member

zensh commented Jan 29, 2016

Hi, disque server send a close signal to client when you shut down, it is not a exception disconnect. In my application, I listened close event and error event, when it occured, event handle throw some error , then application will be restarted.

@ethul
Copy link
Author

ethul commented Jan 29, 2016

Thanks for taking a look. Maybe I am not thinking about this the right way. However, even when I kill -9 <disque-server-process-id>, the end handler is being called. Is this intended?

I am wondering how the client will attempt a reconnect once it is ended. Do you have an example of how this works? It would be very helpful.

Thanks.

@zensh
Copy link
Member

zensh commented Jan 30, 2016

@ethul I fixed this case, released v0.3.0. Here is example: https://github.com/thunks/thunk-disque/blob/master/examples/reconnect-forever.js

@zensh zensh closed this as completed Jan 30, 2016
@ethul
Copy link
Author

ethul commented Feb 2, 2016

Great! And thank you for the example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants