Aidan275 / nativeqda-dev

NativeQDA
http://dev.nativeqda.xyz/
GNU General Public License v3.0
2 stars 0 forks source link

UX when MongoDB is not running #18

Closed Lucas-W closed 7 years ago

Lucas-W commented 7 years ago
Aidan275 commented 7 years ago

MongoDB currently has to be running before Node, running after will not get the system working -- Closing MongoDB once Node is running and then running it again doesn't always return the site to normal

Set timeout loop to attempt to connect to MongoDB every 5 seconds if the first connection attempt fails. If an error occurs or the DB is shutdown after the server has made it's first successful connection, Mongoose will reconnect automatically when possible.

Relevant code

Switching some nav tabs doesn't work while there's no communication to the database and gives no feedback to the User.

Should work okay now, was getting hung up because the server was not responding with any response if there was no connection to the DB, now checks the DB connection status on all DB related API requests and responds with an error if the DB is not connected.

Example

Spinning wheel is uninformative to the User -- Differentiate between normal ~0.25 second loading and 'Database is taking a long time / Not on'

All the loading overlays should now stop when the API request is returned successfully or unsuccessfully.

Example

Aidan275 commented 7 years ago

Should work okay now, was getting hung up because the server was not responding with any response if there was no connection to the DB, now checks the DB connection status on all DB related API requests and responds with an error if the DB is not connected.

Moved this check to a middleware function that can be added to the appropriate requests. This function is executed after the authentication function and checks the database connection status. If 'connected' the next function is executed, otherwise, an error is returned to notify the user.

Relevant Code

Helpful article about Middleware