good morning!!!!

Skip to content
Snippets Groups Projects
Commit 6c586b46 authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

PostgreSQL: Catching a variant of the too many clients error message.

parent 5e481e75
No related branches found
No related tags found
No related merge requests found
...@@ -649,7 +649,7 @@ func waitForConnection(connectFn func() error) error { ...@@ -649,7 +649,7 @@ func waitForConnection(connectFn func() error) error {
// Waitig 5 seconds for a successful connection. // Waitig 5 seconds for a successful connection.
for timeStart := time.Now(); time.Now().Sub(timeStart) < time.Second*5; { for timeStart := time.Now(); time.Now().Sub(timeStart) < time.Second*5; {
if err := connectFn(); err != nil { if err := connectFn(); err != nil {
if strings.Contains(err.Error(), `too many clients`) { if strings.Contains(err.Error(), `too many clients`) || strings.Contains(err.Error(), `remaining connection slots are reserved`) {
// Sleep and try again if, and only if, the server replied with a "too // Sleep and try again if, and only if, the server replied with a "too
// many clients" error. // many clients" error.
time.Sleep(waitTime) time.Sleep(waitTime)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment