This PR introduces the changes to handle the maximum number of database connection retries. This new parameters should be set in the configuration file read by the application (conf.json).
Also, on Windows OS, sometimes the connection attempt freezes and it does not respond again. product-api uses the sqlx package to create the DB connection. This occurs in the internal method “ping” of this package which by default waits indefinitely. To solve this issue, based/on sqlx documentation, we added the “connect_timeout” variable in the DB connection string (db_parameter) of the config.json file with 10 seconds as default value. This new variable allows to set the maximum time to wait for the connection. If product-api can’t connect to database, it continues to next retry.
maxRetries: Max number of retries
backoffExponentialBase: base number used to calculate the exponential back-off before attempting to connect again
connect_timeout: Whole timeout for connection to the DB
This PR introduces the changes to handle the maximum number of database connection retries. This new parameters should be set in the configuration file read by the application (conf.json).
Also, on Windows OS, sometimes the connection attempt freezes and it does not respond again. product-api uses the sqlx package to create the DB connection. This occurs in the internal method “ping” of this package which by default waits indefinitely. To solve this issue, based/on sqlx documentation, we added the “connect_timeout” variable in the DB connection string (db_parameter) of the config.json file with 10 seconds as default value. This new variable allows to set the maximum time to wait for the connection. If product-api can’t connect to database, it continues to next retry.
maxRetries
: Max number of retriesbackoffExponentialBase
: base number used to calculate the exponential back-off before attempting to connect againconnect_timeout
: Whole timeout for connection to the DB