hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

refactor: Throw 500 error on database connection error instead of panic

Open dracarys18 opened this issue 1 year ago • 0 comments

Type of Change

  • [x] Refactoring

Description

Do not panic while getting db connection. Instead of that just throw 500 error. This PR also makes connection timeout in Database configurable.

Additional Changes

  • [x] This PR modifies application configuration/environment variables

Motivation and Context

When database goes down we don't want our application panic and stop actix workers since restarting it has much overhead. So instead just 500 error.

How did you test it?

Start the application and bring down the database and try to make a payment. Throws 500 error. image

Checklist

  • [x] I formatted the code cargo +nightly fmt --all
  • [x] I addressed lints thrown by cargo clippy
  • [x] I reviewed submitted code

dracarys18 avatar Feb 09 '23 09:02 dracarys18