Skip to content

Commit

Permalink
feat: local repo cache breaking for get status, and a generic method
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jun 10, 2022
1 parent 1238a68 commit 6645b72
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/sourceTracking.ts
Expand Up @@ -225,9 +225,20 @@ export class SourceTracking extends AsyncCreatable {
* @returns StatusOutputRow[]
*/

public async getStatus({ local, remote }: { local: boolean; remote: boolean }): Promise<StatusOutputRow[]> {
public async getStatus({
local,
remote,
useCache = true,
}: {
local: boolean;
remote: boolean;
useCache: boolean;
}): Promise<StatusOutputRow[]> {
let results: StatusOutputRow[] = [];
if (local) {
if (!useCache) {
await this.reReadLocalTrackingCache();
}
results = results.concat(await this.getLocalStatusRows());
}
if (remote) {
Expand Down Expand Up @@ -452,6 +463,9 @@ export class SourceTracking extends AsyncCreatable {
await this.remoteSourceTrackingService.syncSpecifiedElements(fileResponses);
}

public async reReadLocalTrackingCache(): Promise<void> {
await this.localRepo.getStatus(true);
}
/**
* If the local tracking shadowRepo doesn't exist, it will be created.
* Does nothing if it already exists.
Expand Down

0 comments on commit 6645b72

Please sign in to comment.