backend-common: workaround for database client being collected before interval
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-common': patch
|
||||
---
|
||||
|
||||
Workaround for a rare race condition in tests.
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user