🐛 Update initialization checks (#3147)

This commit is contained in:
Iván Ovejero 2022-04-19 12:22:05 +02:00 committed by GitHub
parent 0081d02b97
commit f4e9562451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -423,7 +423,7 @@ export class CredentialsHelper extends ICredentialsHelper {
// eslint-disable-next-line @typescript-eslint/await-thenable
const credentials = await this.getCredentials(nodeCredentials, type);
if (Db.collections.Credentials === null) {
if (!Db.isInitialized) {
// The first time executeWorkflow gets called the Database has
// to get initialized first
await Db.init();

View file

@ -300,7 +300,7 @@ class App {
}
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
if (Db.collections.Workflow === null) {
if (!Db.isInitialized) {
const error = new ResponseHelper.ResponseError('Database is not ready!', undefined, 503);
return ResponseHelper.sendErrorResponse(res, error);
}

View file

@ -789,7 +789,7 @@ export async function getWorkflowData(
let workflowData: IWorkflowBase | undefined;
if (workflowInfo.id !== undefined) {
if (Db.collections.Workflow === null) {
if (!Db.isInitialized) {
// The first time executeWorkflow gets called the Database has
// to get initialized first
await Db.init();