Closed RobAndrewHurst closed 1 week ago
I have update the module documentation to include requires for the pg and logger. The documentation for pg.Pool is linked in the docs.
Putting back into draft to address some issues
I removed the retry codes as these are ambiguous dependent on the dbs provider and version. It is also not clear which type of error should be retried.
I created a sleep function as this easier to understand than a const sleep that is a function.
I created the clientQuery function to receive the pool param which has the dbs as an option.
It should be possible to set the RETRY_LIMIT through the process configuration. Ideally by adding a property to the connection string.
The dbs_string now takes an additional optional parameter at the end of the connection string itself separated by a '|'. This will override the RETRY_LIMIT on the module.
@dbauszus-glx Where should we add in this documentation? Into the wiki or on the module itself explaining how connection string work?
Having thought about this. It is probably better to use process.env.RETRY_LIMIT for documentation purposes.
This and the DBS need to be added to the global env type documentation.
Having thought about this. It is probably better to use process.env.RETRY_LIMIT for documentation purposes.
This and the DBS need to be added to the global env type documentation.
This has now been updated. The RETRY_LIMIT const will be assigned from the process.env.RETRY_LIMIT if it is present otherwise it will default to 3.
I have also included the DBS_ param and RETRY_LIMIT in the global .env docs
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
pg dbs connection management improvements & docs π
Overview
This PR implements robust database connection handling with retry logic, better error management, and connection pooling optimizations for our PostgreSQL connections.
Key Changes
Detailed Implementation
1. Retry Logic
2. Connection Pool Configuration
3. Error Handling
4. Resource Management
5. Logging Enhancements
Testing
Performance Impact
Documentation
JSDoc documentation has been added.
Testing Checklist
Security Considerations