backend-common: workaround for database client being collected before interval

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-09-07 16:48:30 +02:00
parent b8b2d4ab04
commit 96689fbdcb
2 changed files with 8 additions and 1 deletions
@@ -352,7 +352,9 @@ export class DatabaseManager {
let lastKeepaliveFailed = false;
setInterval(() => {
client.raw('select 1').then(
// During testing it can happen that the environment is torn down and
// this client is `undefined`, but this interval is still run.
client?.raw('select 1').then(
() => {
lastKeepaliveFailed = false;
},