mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 20:39:28 +00:00
Close database connection when finished with it
This commit is contained in:
@@ -81,6 +81,8 @@ class Class {
|
||||
classId
|
||||
]);
|
||||
|
||||
conn.close();
|
||||
|
||||
this.teacherIds = ids.map(record => record.id);
|
||||
|
||||
const [ teachers, subject ] = await Promise.all([
|
||||
|
||||
@@ -32,6 +32,8 @@ class PasswordReset {
|
||||
token
|
||||
]);
|
||||
|
||||
conn.close();
|
||||
|
||||
if (!record.length)
|
||||
throw new Error('No password reset found');
|
||||
|
||||
@@ -69,6 +71,8 @@ class PasswordReset {
|
||||
|
||||
await conn.runQuery(sql, [ u.id ]);
|
||||
|
||||
conn.close();
|
||||
|
||||
const [ nonce, token ] = await PasswordReset.hashToken(u);
|
||||
|
||||
const d = new Date();
|
||||
|
||||
@@ -35,6 +35,8 @@ class Subject {
|
||||
subjectId,
|
||||
]);
|
||||
|
||||
conn.close();
|
||||
|
||||
if (!record.length)
|
||||
throw new Error('No subject found');
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ class Test {
|
||||
testId,
|
||||
]);
|
||||
|
||||
conn.close();
|
||||
|
||||
if (!record.length)
|
||||
throw new Error('No test found');
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ class TestTemplate {
|
||||
testTemplateId,
|
||||
]);
|
||||
|
||||
conn.close();
|
||||
|
||||
if (!record.length)
|
||||
throw new Error('No test template found');
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ class User {
|
||||
const res =
|
||||
await conn.runQuery(sql, [ userId ]);
|
||||
|
||||
conn.close();
|
||||
|
||||
if (!res.length)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user