mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 13:00:56 +03:00
Ensure proper cleanup of the database connection in createSchema (#5315)
* Ensure proper cleanup of the database connection in `createSchema` method in `MySQLRecordManager`. * Update MySQLrecordManager.ts * Refactor createSchema to optimize dataSource usage Refactor createSchema method to avoid duplicate dataSource retrieval. * Refactor createSchema method for efficiency Refactor createSchema to avoid redundant dataSource retrieval. --------- Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
+3
-1
@@ -222,8 +222,8 @@ class PostgresRecordManager implements RecordManagerInterface {
|
||||
}
|
||||
|
||||
async createSchema(): Promise<void> {
|
||||
const dataSource = await this.getDataSource()
|
||||
try {
|
||||
const dataSource = await this.getDataSource()
|
||||
const queryRunner = dataSource.createQueryRunner()
|
||||
const tableName = this.sanitizeTableName(this.tableName)
|
||||
|
||||
@@ -251,6 +251,8 @@ class PostgresRecordManager implements RecordManagerInterface {
|
||||
return
|
||||
}
|
||||
throw e
|
||||
} finally {
|
||||
await dataSource.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user