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(
|
const compactedEntries = await Array.fromAsync(
|
||||||
Deno.readDir("./data/plc/compacted")
|
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) {
|
for (const entry of compactedEntries) {
|
||||||
const process = new Deno.Command("zstd", {
|
const process = new Deno.Command("zstd", {
|
||||||
args: [
|
args: [
|
||||||
|
|
@ -37,14 +39,18 @@ export const getOperations = async (did: string) => {
|
||||||
await process.status;
|
await process.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
const f = await Deno.open(`./data/plc/live/${prefix}`, { read: true });
|
try {
|
||||||
const lines = f.readable
|
const f = await Deno.open(`./data/plc/live/${prefix}`, { read: true });
|
||||||
.pipeThrough(new TextDecoderStream())
|
const lines = f.readable
|
||||||
.pipeThrough(new TextLineStream());
|
.pipeThrough(new TextDecoderStream())
|
||||||
for await (const line of lines.values()) {
|
.pipeThrough(new TextLineStream());
|
||||||
const entry = JSON.parse(line) as unknown as ExportEntry;
|
for await (const line of lines.values()) {
|
||||||
if (entry.did !== did) continue;
|
const entry = JSON.parse(line) as unknown as ExportEntry;
|
||||||
operations.push(entry);
|
if (entry.did !== did) continue;
|
||||||
|
operations.push(entry);
|
||||||
|
}
|
||||||
|
} catch (_err) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
return operations;
|
return operations;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue