Skip to content

Commit

Permalink
chore: logs
Browse files Browse the repository at this point in the history
  • Loading branch information
horpeazy committed Aug 22, 2024
1 parent c12ce7a commit c4989af
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,35 +567,35 @@ export class PSQLRecordOperationWatcher extends EventEmitter {
}

async watchAllBases() {
process.stderr.write('watchAllBases : called\n');
process.stderr.write('watchAllBases : called');
const projects = await Project.list({});
process.stderr.write(`watchAllBases : projects: ${JSON.stringify(projects)}\n`);
process.stderr.write(`watchAllBases : projects: ${JSON.stringify(projects)}`);
const bases = (
await Promise.all(projects.map((project) => project.getBases()))
).flat();
process.stderr.write(`watchAllBases : bases: ${JSON.stringify(bases)}\n`);
process.stderr.write(`watchAllBases : bases: ${JSON.stringify(bases)}`);
const baseIds = bases.map((base) => base.id);
process.stderr.write(`watchAllBases : baseIds: ${JSON.stringify(baseIds)}\n`);
process.stderr.write(`watchAllBases : baseIds: ${JSON.stringify(baseIds)}`);
//////// Retreive watched base data from DB and set it in this.allBaseData.

const allObsoleteBaseData = Array.from(this.allBaseData.values()).filter(
(baseData) => !baseIds.includes(baseData.base.id)
); // this will always be null as this.allBaseData should be empty at this point as no baseData
// exists in allBaseData confirm with logs
process.stderr.write(`watchAllBases : allObsoleteBaseData: ${JSON.stringify(allObsoleteBaseData)}\n`);
process.stderr.write(`watchAllBases : allObsoleteBaseData: ${JSON.stringify(allObsoleteBaseData)}`);

// this.log(JSON.stringify({ allBaseData: this.allBaseData }));
// this.log(JSON.stringify({ allObsoleteBaseData }));
for (const base of bases) {
await this.watchBase(base);
}
process.stderr.write('watchAllBases : done watching bases\n');
process.stderr.write('watchAllBases : done watching bases');

for (const obsoleteBaseData of allObsoleteBaseData) {
// no base will ever be unwatched as allObsoleteBaseData is empty
await this.unwatchBase(obsoleteBaseData.base);
}
process.stderr.write('watchAllBases : done unwatching bases\n');
process.stderr.write('watchAllBases : done unwatching bases');
}

private async createKnex(base: Base): Promise<XKnex> {
Expand Down

0 comments on commit c4989af

Please sign in to comment.