Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

added sleep env variable for db connect timeout #351

Merged
merged 1 commit into from
Mar 15, 2022
Merged

added sleep env variable for db connect timeout #351

merged 1 commit into from
Mar 15, 2022

Conversation

wadeking98
Copy link
Contributor

Added functionality to wait 30 seconds (by default) to allow the db container to properly startup in openshift.
Set the amount of wait time using the environment variable DB_CONNECT_SLEEP
Resolves: #348
Signed-off-by: wadeking98 wkingnumber2@gmail.com

@wadeking98 wadeking98 requested a review from WadeBarnes March 14, 2022 19:56
Copy link
Member

@WadeBarnes WadeBarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to impose a fix length wait before attempting to connect, we want to configurably extent the serverSelectionTimeoutMS so the connection will only wait longer if it cannot connect to the database right away.

I believe it would just be an option parameter like useNewUrlParser and useUnifiedTopology; see MongoClient.connect here, https://mongodb.github.io/node-mongodb-native/3.7/api/MongoClient.html

@wadeking98 wadeking98 requested a review from WadeBarnes March 14, 2022 21:08
Copy link
Member

@WadeBarnes WadeBarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See suggestions below. Also the value of serverSelectionTimeout should default to 30 seconds in the case the SERVER_SELECTION_TIMEOUT env variable is not defined.

api/config/default.json Outdated Show resolved Hide resolved
api/src/mongodb.ts Outdated Show resolved Hide resolved
api/src/mongodb.ts Outdated Show resolved Hide resolved
docker/api/config/default.json Outdated Show resolved Hide resolved
docker/docker-compose.yml Outdated Show resolved Hide resolved
docker/docker-compose.yml Outdated Show resolved Hide resolved
docker/manage Outdated Show resolved Hide resolved
Signed-off-by: wadeking98 <wkingnumber2@gmail.com>
@wadeking98 wadeking98 requested a review from WadeBarnes March 15, 2022 00:03
@WadeBarnes WadeBarnes merged commit 9c2570f into bcgov:main Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix initial database connection issue
2 participants