Skip to content

Commit

Permalink
Drop existing retry logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaidioz committed Aug 27, 2024
1 parent 44de384 commit 7eb4b0c
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,12 @@ class SqlConnectionPool()(implicit settings: RawSettings) extends RawService wit
// No connection available...

// Check if we must release connections to make space.
var retries = 10
while (getTotalActiveConnections() >= maxConnections && retries >= 0) {
if (getTotalActiveConnections() >= maxConnections) {
if (!releaseOldestConnection()) {
logger.warn(s"Could not release oldest connection; retry #$retries")
// We could not successfully release any connection, so bail out.
logger.warn(s"Could not release oldest connection")
throw new SQLException("no connections available", "08000")
}
retries -= 1
// (msb) Why do I do this? I don't know; I'm assuming by sleeping we increase the change of successful release.
Thread.sleep(10)
}

// We could not successfully release any connection, so bail out.
if (getTotalActiveConnections() >= maxConnections) {
throw new SQLException("no connections available", "08000")
}

// Create a new connection.
Expand Down Expand Up @@ -298,8 +291,7 @@ class SqlConnectionPool()(implicit settings: RawSettings) extends RawService wit
if (retries > 0) {
Thread.sleep(retryInterval)
retryConnection(retries - 1)
}
else {
} else {
throw t
}
}
Expand Down

0 comments on commit 7eb4b0c

Please sign in to comment.