Skip to content

Commit

Permalink
🐛 Update initialization checks (#3147)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Apr 19, 2022
1 parent 0081d02 commit f4e9562
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/CredentialsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/WebhookServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/WorkflowExecuteAdditionalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f4e9562

Please sign in to comment.