connect-mongodb-session
connect-mongodb-session copied to clipboard
Bubble up 'reconnectFailed' event
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?
Did you pass a callback to the MongoDBStore constructor to catch errors? I'd assume you'd want to handle there.
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 }}
@goliatone is this error on initial connection? Or after the store is successfully running?
@vkarpov15 it happens after the app is running for a while.
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.