refactor(core): Move webhook DB access to repository (no-changelog) (#6706)

* refactor(core): Move webhook DB access to repository (no-changelog)

* make sure `DataSource` is initialized before it's dependencies

at some point I hope to replace `DataSource` with a custom `DatabaseConnection` service class that can then disconnect and reconnect from DB without having to update all repositories.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Iván Ovejero
2023-07-25 18:17:34 +02:00
committed by GitHub
parent ed9f86bb95
commit bcfc5e717b
4 changed files with 19 additions and 14 deletions

View File

@@ -104,6 +104,9 @@ class WorkflowRunnerProcess {
this.startedAt = new Date();
// Init db since we need to read the license.
await Db.init();
const userSettings = await UserSettings.prepareUserSettings();
const loadNodesAndCredentials = Container.get(LoadNodesAndCredentials);
@@ -117,9 +120,6 @@ class WorkflowRunnerProcess {
const externalHooks = Container.get(ExternalHooks);
await externalHooks.init();
// Init db since we need to read the license.
await Db.init();
const instanceId = userSettings.instanceId ?? '';
await Container.get(PostHogClient).init(instanceId);
await Container.get(InternalHooks).init(instanceId);