Skip to content
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

Bubble up 'reconnectFailed' event #48

Open
goliatone opened this issue Jan 16, 2018 · 5 comments
Open

Bubble up 'reconnectFailed' event #48

goliatone opened this issue Jan 16, 2018 · 5 comments

Comments

@goliatone
Copy link

I'm getting the following error:

Error finding fik2w7v-AqcYBZZ6ib8SgcL58j44RMoL: Topology was destroyed

I want to reconnect but currently the store creates the connection in the constructor and exposes no method. How are we supposed to handle reconnections?

@mckenzieja
Copy link

Did you pass a callback to the MongoDBStore constructor to catch errors? I'd assume you'd want to handle there.

@eug48
Copy link

eug48 commented Dec 4, 2018

For the initial connection, you might need to do a process.exit() in the constructor's callback and get whatever is running your program to automatically restart it. For subsequent errors it seems like you can pass in something like
{ connectionOptions: { reconnectTries: Number.MAX_SAFE_INTEGER, reconnectInterval: 1000 }}

@vkarpov15
Copy link
Member

@goliatone is this error on initial connection? Or after the store is successfully running?

@goliatone
Copy link
Author

@vkarpov15 it happens after the app is running for a while.

@vkarpov15
Copy link
Member

Try setting connectionOptions.reconnectTries as @eug48 suggested. Here's an explanation of why this is necessary. In the meantime, I'll keep this issue open because we should probably emit an 'error' event if we get a reconnectFailed event.

@vkarpov15 vkarpov15 changed the title [reconnect] How to recover from errors Bubble up 'reconnectFailed' event Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants