ListBot icon indicating copy to clipboard operation
ListBot copied to clipboard

[BUG] MongoDB error-handling

Open vitasenka opened this issue 5 years ago • 3 comments

The bot replies with success message even if MongoDB server is not available.

How to produce the bug:

  1. Start MongoDB server.
  2. Start the bot.
  3. Shutdown the MongoDB server.
  4. Use bot commands.

catchBug

vitasenka avatar Oct 28 '20 13:10 vitasenka

Yes, I can reproduce this. The reply from bot takes some time(30seconds) which is probably when the request to DB times out.

RazCrimson avatar Oct 28 '20 17:10 RazCrimson

@rgroves We can stop the bot when the DB gets disconnected the connection times out?

RazCrimson avatar Oct 30 '20 14:10 RazCrimson

LIstBot needs better error handling. In some places, especially in most commands when interacting with the database, it's non-existent.

I think it would be good to have two things done in starting to address this issue, and this probably needs some further examination of the codebase to see exactly what needs doing, but in general:

  1. Allow user to make connection timeout configurable—meaning they can lower the timeout value by overriding in the .env file. (this will make testing easier as well, so you won't need to wait the full 30 second default timeout).

  2. Add try...catch blocks where needed in the commands so that we can capture, log, and report back a clear message to bot users when there is an issue.

This is something that definitely should be addressed.

rgroves avatar Oct 31 '20 17:10 rgroves