Skip to content

Commit

Permalink
Impl enumAllMoments correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ledyba committed May 9, 2022
1 parent a3ed9e8 commit 6776dc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions server/src/cmd/gc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ async function main() {
const repo = new Repo();
const shelf = new Shelf(repo);
const usedEntiry = new Set<string>();
let numMoments = 0;
try {
for await (let m of shelf.enumAllMoments()) {
for await (let m of repo.enumAllMoments()) {
numMoments++;
for (let block of fml.parse(m.text).blocks) {
switch (block.type) {
case "image": {
Expand Down Expand Up @@ -37,7 +39,7 @@ async function main() {
}
}
}
console.log(`Found ${usedEntiry.size} used entities.`);
console.log(`Found ${numMoments} moments, ${usedEntiry.size} entities used.`);
} finally {
await repo.close();
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/shelf/Shelf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Shelf {
icon: new Storage(this.storagePath, 'icon'),
};
}
async* enumAllMoments(): AsyncGenerator<Moment> {
enumAllMoments(): AsyncGenerator<Moment> {
return this.repo.enumAllMoments();
}
async findEntity(id: string): Promise<Entity | null> {
Expand Down

0 comments on commit 6776dc0

Please sign in to comment.