Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/io/supertokens/storage/postgresql/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ public void deleteAllInformation() throws StorageQueryException {
// this can happen if the db being connected to is not actually present.
// So we ignore this since there are tests in which we are adding a non existent db for a tenant,
// and we want to not throw errors in the next test wherein this function is called.
} else if (e.getMessage() != null && e.getMessage().contains("has been closed")) {
// this can happen if the connection pool was already closed, e.g. due to a race condition
// during test teardown where a background thread closed the pool. It's safe to ignore.
} else {
throw new StorageQueryException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ public void kill(boolean removeAllInfo) throws InterruptedException {
try {
main.deleteAllInformationForTesting();
} catch (Exception e) {
if (!e.getMessage().contains("Please call initPool before getConnection")) {
// we ignore this type of message because it's due to tests in which the init failed
if (e.getMessage() != null &&
!e.getMessage().contains("Please call initPool before getConnection") &&
!e.getMessage().contains("has been closed")) {
// we ignore these types of messages because they are due to tests in which the init failed
// and here we try and delete assuming that init had succeeded.
throw new RuntimeException(e);
}
Expand Down
Loading