Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(assetlibrary): add retry mechanism for connection error #178

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yuma124
Copy link
Contributor

@yuma124 yuma124 commented Oct 30, 2023

Description

Since #168, we have occasionally encountered database connection errors. These errors are related to database connectivity, and in my opinion they should be retried in the AssetLibrary. In this Pull Request, I've added retry mechanism for connection errors.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (existing code being refactored)
  • This change includes a documentation update

Submission Checklist

  • CI dry-run passing
  • Integration tests passing locally
  • Change logs generated
Additional Notes:

@canavandl
Copy link
Contributor

Thanks for the PR @yuma124 ! I'll aim to review it by end-of-week

@aaronatbissell
Copy link
Contributor

aaronatbissell commented Jan 26, 2024

I feel like a more proper fix here would be to open the DB connection outside of the lambda handler (from here):

A common best practice is to open the database connection outside the Lambda handler function so that it can be reused with each handler call.

@ts-amz
Copy link
Contributor

ts-amz commented Jan 26, 2024

I feel like a more proper fix here would be to open the DB connection outside of the lambda handler (from here):

A common best practice is to open the database connection outside the Lambda handler function so that it can be reused with each handler call.

+1 to this.

@yuma124
Copy link
Contributor Author

yuma124 commented Jan 29, 2024

@aaronatbissell @ts-amz
Thank you for your suggestion. I understand the importance of reusing the DB connection with each handler call. I have structured the code in a way that allows the DB connection to be reused within the Lambda's execution context.

Is it necessary to open the DB connection outside of the Lambda handler? If we refer to the Neptune sample code here, we can see that they also open the DB connection in the lambda handler and reuse with each handler call.

If there are any specific concerns or aspects that you think I might have overlooked, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants