Skip to content

Commit

Permalink
🐛 [membership-service] Retry db connection, end program if unsuccessful
Browse files Browse the repository at this point in the history
When using ArgoCD for deployment, "wait:true" to wait for the database
in the skaffold.yaml, is not applied, instead all services are created
in parallel. The membership-service tries to connect once to the not yet ready db,
and then waits, doing nothing. To mitigate this the option EnableRetryOnFailure
was added. Now the service tries in a timespan of 60 seconds to connect ten times,
and if it still fails exists the program, causing a recreation of the pod.
  • Loading branch information
MfCrizz committed Mar 15, 2023
1 parent 4419fd2 commit 0d33363
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/membership-service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ private static void CreateDbIfNotExists(IHost host)
{
var logger = services.GetRequiredService<ILogger<Program>>();
logger.LogError(ex, "An error occurred creating the DB.");
// Restart the pod until success
System.Environment.Exit(1);
}
}
Expand Down

0 comments on commit 0d33363

Please sign in to comment.