我有一个连接到oracle DB的Node js应用程序。Connection.release没有释放回池的连接,这导致了内存泄漏和程序崩溃。
let connection = await getConnection(poolconfiguration); //gets connection from pool
let result = await executequery(connection, query); //executes query and returns result
connection.release(); //releases the connection to the pool
return result; //returns the result to the called function我们需要对每个传入请求的结果进行清理吗?
发布于 2021-08-14 23:26:16
请张贴一个完整的脚本,并显示像executequery这样的功能。根据代码片段的猜测,您应该使用await,例如await connection.close()
connection.release()函数是connection.close()的别名,但已被弃用-文档称它将在未来的版本中删除。
检查所有node-oracledb examples以获得良好的实践。
https://stackoverflow.com/questions/68784979
复制相似问题