Skip to content
Snippets Groups Projects
Commit 2b35fd3f authored by Cédric Moreau's avatar Cédric Moreau
Browse files

fix(1434): put back value of `expires_on`, not `expired_on`

parent 294ad688
No related branches found
No related tags found
No related merge requests found
...@@ -87,16 +87,16 @@ export class LevelMIndexExpiresOnIndexer extends LevelDBDataIndex< ...@@ -87,16 +87,16 @@ export class LevelMIndexExpiresOnIndexer extends LevelDBDataIndex<
} }
}) })
); );
// Case 2: expiration REVERT // Case 2: REVERT expired = put back the value of `expires_on`
const values: MindexEntry[] = Underscore.values( const values: MindexEntry[] = Underscore.values(
newStateByPub newStateByPub
).map((entries) => reduce(entries)); ).map((entries) => reduce(entries));
const byExpiredOn = reduceGroupBy(values, "expired_on"); const byExpiresOnForExpired = reduceGroupBy(values, "expires_on");
await Promise.all( await Promise.all(
Underscore.keys(byExpiredOn).map(async (expiresOn) => Underscore.keys(byExpiresOnForExpired).map(async (expiresOn) =>
this.addAllKeysToExpiresOn( this.addAllKeysToExpiresOn(
pint(expiresOn), pint(expiresOn),
byExpiredOn[expiresOn].map((e) => e.pub) byExpiresOnForExpired[expiresOn].map((e) => e.pub)
) )
) )
); );
...@@ -112,7 +112,9 @@ export class LevelMIndexExpiresOnIndexer extends LevelDBDataIndex< ...@@ -112,7 +112,9 @@ export class LevelMIndexExpiresOnIndexer extends LevelDBDataIndex<
entry = []; entry = [];
} }
for (const pub of pubkeys) { for (const pub of pubkeys) {
entry.push(pub); if (!entry.includes(pub)) {
entry.push(pub);
}
} }
await this.put(key, entry); await this.put(key, entry);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment