Explorar o código

core: add debug logging to troubleshoot share compaction loading

Dax Raad hai 4 meses
pai
achega
4acb645f04
Modificáronse 2 ficheiros con 7 adicións e 4 borrados
  1. 3 3
      .opencode/opencode.jsonc
  2. 4 1
      packages/enterprise/src/core/share.ts

+ 3 - 3
.opencode/opencode.jsonc

@@ -1,9 +1,9 @@
 {
   "$schema": "https://opencode.ai/config.json",
   "plugin": ["opencode-openai-codex-auth"],
-  // "enterprise": {
-  //   "url": "https://enterprise.dev.opencode.ai",
-  // },
+  "enterprise": {
+    "url": "https://enterprise.dev.opencode.ai",
+  },
   "provider": {
     "opencode": {
       "options": {

+ 4 - 1
packages/enterprise/src/core/share.ts

@@ -85,16 +85,19 @@ export namespace Share {
   }
 
   export async function data(shareID: string) {
+    console.log("reading compaction")
     const compaction: Compaction = (await Storage.read<Compaction>(["share_compaction", shareID])) ?? {
       data: [],
       event: undefined,
     }
-
+    console.log("reading pending events")
     const list = await Storage.list({
       prefix: ["share_event", shareID],
       end: compaction.event,
     }).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())
     for (const item of data) {
       if (!item) continue