fix compaction sorting and missing live lookups
This commit is contained in:
parent
c539a4dc5a
commit
1e0ff83f8b
1 changed files with 15 additions and 9 deletions
|
|
@ -10,7 +10,9 @@ export const getOperations = async (did: string) => {
|
|||
const compactedEntries = await Array.fromAsync(
|
||||
Deno.readDir("./data/plc/compacted")
|
||||
);
|
||||
compactedEntries.sort();
|
||||
compactedEntries.sort((a, b) =>
|
||||
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
||||
);
|
||||
for (const entry of compactedEntries) {
|
||||
const process = new Deno.Command("zstd", {
|
||||
args: [
|
||||
|
|
@ -37,6 +39,7 @@ export const getOperations = async (did: string) => {
|
|||
await process.status;
|
||||
}
|
||||
|
||||
try {
|
||||
const f = await Deno.open(`./data/plc/live/${prefix}`, { read: true });
|
||||
const lines = f.readable
|
||||
.pipeThrough(new TextDecoderStream())
|
||||
|
|
@ -46,6 +49,9 @@ export const getOperations = async (did: string) => {
|
|||
if (entry.did !== did) continue;
|
||||
operations.push(entry);
|
||||
}
|
||||
} catch (_err) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return operations;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue