mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Use injectable classes for db repositories (part-1) (no-changelog) (#5953)
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
committed by
GitHub
parent
323e26acfd
commit
10f8c35dbb
@@ -51,13 +51,13 @@ export abstract class BaseCommand extends Command {
|
||||
const credentialTypes = Container.get(CredentialTypes);
|
||||
CredentialsOverwrites(credentialTypes);
|
||||
|
||||
this.instanceId = this.userSettings.instanceId ?? '';
|
||||
await Container.get(PostHogClient).init(this.instanceId);
|
||||
await Container.get(InternalHooks).init(this.instanceId);
|
||||
|
||||
await Db.init().catch(async (error: Error) =>
|
||||
this.exitWithCrash('There was an error initializing DB', error),
|
||||
);
|
||||
|
||||
this.instanceId = this.userSettings.instanceId ?? '';
|
||||
await Container.get(PostHogClient).init(this.instanceId);
|
||||
await Container.get(InternalHooks).init(this.instanceId);
|
||||
}
|
||||
|
||||
protected async stopProcess() {
|
||||
@@ -96,7 +96,7 @@ export abstract class BaseCommand extends Command {
|
||||
if (inTest || this.id === 'start') return;
|
||||
if (Db.isInitialized) {
|
||||
await sleep(100); // give any in-flight query some time to finish
|
||||
await Db.connection.destroy();
|
||||
await Db.getConnection().destroy();
|
||||
}
|
||||
const exitCode = error instanceof ExitError ? error.oclif.exit : error ? 1 : 0;
|
||||
this.exit(exitCode);
|
||||
|
||||
Reference in New Issue
Block a user