We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf06389 commit a737478Copy full SHA for a737478
src/utils/dbConnection.js
@@ -33,6 +33,21 @@ const connect = async () => {
33
return conn;
34
};
35
36
+// SIGTERM Handler
37
+// from https://github.com/aws-samples/graceful-shutdown-with-aws-lambda
38
+process.on('SIGTERM', async () => {
39
+ console.info('[runtime] SIGTERM received');
40
+
41
+ console.info('[runtime] cleaning up');
42
+ if(conn !== null){
43
+ let realConn = await conn
44
+ await realConn.$pool.end()
45
+ }
46
47
+ console.info('[runtime] exiting');
48
+ process.exit(0)
49
+});
50
51
module.exports = {
52
pgp,
53
connect,
0 commit comments