mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-01 22:10:23 +00:00
core: add debug logging to troubleshoot share compaction loading
This commit is contained in:
parent
ef664039ac
commit
4acb645f04
2 changed files with 7 additions and 4 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://opencode.ai/config.json",
|
"$schema": "https://opencode.ai/config.json",
|
||||||
"plugin": ["opencode-openai-codex-auth"],
|
"plugin": ["opencode-openai-codex-auth"],
|
||||||
// "enterprise": {
|
"enterprise": {
|
||||||
// "url": "https://enterprise.dev.opencode.ai",
|
"url": "https://enterprise.dev.opencode.ai",
|
||||||
// },
|
},
|
||||||
"provider": {
|
"provider": {
|
||||||
"opencode": {
|
"opencode": {
|
||||||
"options": {
|
"options": {
|
||||||
|
|
|
||||||
|
|
@ -85,16 +85,19 @@ export namespace Share {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function data(shareID: string) {
|
export async function data(shareID: string) {
|
||||||
|
console.log("reading compaction")
|
||||||
const compaction: Compaction = (await Storage.read<Compaction>(["share_compaction", shareID])) ?? {
|
const compaction: Compaction = (await Storage.read<Compaction>(["share_compaction", shareID])) ?? {
|
||||||
data: [],
|
data: [],
|
||||||
event: undefined,
|
event: undefined,
|
||||||
}
|
}
|
||||||
|
console.log("reading pending events")
|
||||||
const list = await Storage.list({
|
const list = await Storage.list({
|
||||||
prefix: ["share_event", shareID],
|
prefix: ["share_event", shareID],
|
||||||
end: compaction.event,
|
end: compaction.event,
|
||||||
}).then((x) => x.toReversed())
|
}).then((x) => x.toReversed())
|
||||||
|
|
||||||
|
console.log("compacting", list.length)
|
||||||
|
|
||||||
const data = await Promise.all(list.map(async (event) => await Storage.read<Data[]>(event))).then((x) => x.flat())
|
const data = await Promise.all(list.map(async (event) => await Storage.read<Data[]>(event))).then((x) => x.flat())
|
||||||
for (const item of data) {
|
for (const item of data) {
|
||||||
if (!item) continue
|
if (!item) continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue