Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Connection refused Handling #2707

Unanswered
stevedivinep asked this question in Q&A
Discussion options

I am currently working on a project using Laravel 8 with jenssegers version 3.8. The project involves the use of both MySQL and MongoDB databases, with approximately 90% of the modules relying on MySQL and the remaining 10% on MongoDB. The issue I'm facing is that when the MongoDB server is down, it results in the entire application being inaccessible. I am seeking guidance on how to handle this situation. Ideally, I would like the application to gracefully continue functioning by utilizing the MySQL modules when the MongoDB server is unavailable. Any assistance or advice on implementing a robust solution to handle this scenario would be greatly appreciated. Thank you for your time and support.

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

Hell @stevedivinep, the MongoDB\Client doesn't initiate the communication with the server before the first command. There may be some code in you application or in this library that runs a command on every application request.

Can you give the exception with the full backtrace, and maybe check the code that causes this error? You can test by setting an incorrect url in your configuration.

You must be logged in to vote
3 replies
Comment options

you are correct @GromNaN ,Library that runs a command on every application request. I need to handle this. But i don't know how to handle this situation.

Comment options

If you own the code that does the command, wrap it in a try-catch if it's only to continue the execution in case of error.

I don't have enough information to help you otherwise.

Comment options

I have already performed these actions. Nevertheless, the server error page persists. I have attempted changes in both the vendor page and Exception/Handler.php. In the vendor file, the error does not occur within the catch block. In the Handler file, the exception is thrown, but I am uncertain about how to redirect to another page or handle it differently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /