Skip to content

Commit 367bb56

Browse files
committed
Revert "refactor: move Org from class/init to the only method that needs it (JIT)"
This reverts commit e15d792.
1 parent e15d792 commit 367bb56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/shared/remoteSourceTrackingService.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const getMetadataKey = (metadataType: string, metadataName: string): string => {
9090
export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTrackingService.Options> {
9191
private static remoteSourceTrackingServiceDictionary: Dictionary<RemoteSourceTrackingService> = {};
9292
protected logger!: Logger;
93+
private org!: Org;
9394
private isSourceTrackedOrg = true;
9495

9596
// A short term cache (within the same process) of query results based on a revision.
@@ -129,6 +130,7 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
129130
public async init(): Promise<void> {
130131
this.options.filePath = pathJoin('orgs', this.options.username);
131132
this.options.filename = RemoteSourceTrackingService.getFileName();
133+
this.org = await Org.create({ aliasOrUsername: this.options.username });
132134
this.logger = await Logger.child(this.constructor.name);
133135

134136
try {
@@ -539,8 +541,8 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
539541
if (!quiet) {
540542
this.logger.debug(query);
541543
}
542-
const org = await Org.create({ aliasOrUsername: this.options.username });
543-
const results = await org.getConnection().tooling.autoFetchQuery<T>(query);
544+
545+
const results = await this.org.getConnection().tooling.autoFetchQuery<T>(query);
544546

545547
return results.records;
546548
}

0 commit comments

Comments
 (0)