Skip to content

Commit

Permalink
GC user items
Browse files Browse the repository at this point in the history
  • Loading branch information
wraitii committed Jan 24, 2024
1 parent 66ef904 commit 13c5f20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/builder/UserItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export abstract class GeneralizedUserItem implements perUserStorable {
let reprocess = false;
const promises = new Map<any, Promise<any>>();
// Process metadata and clean it up where it seems like things went through (this is a bit optimistic but that's probably OK)
for (const tokenName in this.metadata)
for (const tokenName in this.metadata) {
if (this.metadata[tokenName].updates.length === 0) {
delete this.metadata[tokenName];
continue;
}
for (let i = 0; i < this.metadata[tokenName].updates.length; ++i) {
const update = this.metadata[tokenName].updates[i];
// Clear the metadata if we are now ahead of it.
Expand Down Expand Up @@ -97,6 +101,7 @@ export abstract class GeneralizedUserItem implements perUserStorable {
} else
tokens.push(tokenName);
}
}
// Update locally, then wait for pending stuff and see if we need to reprocess.
this._tokenNames = tokens;
for (const item of promises)
Expand Down

0 comments on commit 13c5f20

Please sign in to comment.