Pinjasaur/whenisgucci

Fix `MongoError: Topology was destroyed`

Opened this issue · 0 comments

Connection to Mongo seems to randomly be dropped.

When hitting an endpoint i.e. /create that interacts with the DB, Express will return with a 500 error consisting of MongoError: Topology was destroyed.

Somewhat related to #113.

There does not seem to be an immediately obvious culprit/solution available.

May be worth implementing a /health endpoint that could do a simple DB query to verify the connection is still up. Could run every minute in a cron job and have PM2 restart the Node apps if they aren't healthy.