File size: 1,069 Bytes
4435002
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

import { runSync } from '../lib/sync-service';
import { JsonStore } from '../lib/store';

async function main() {
    console.log("Starting manual sync debug...");

    // 1. Check initial status
    console.log("Initial Status:", JsonStore.getStatus());

    // 2. Trigger Sync
    try {
        console.log("Calling runSync()...");
        const res = await runSync({ force: true });
        console.log("runSync returned:", res);
    } catch (e) {
        console.error("runSync failed:", e);
    }

    // 3. Poll status for 10 seconds
    const start = Date.now();
    while (Date.now() - start < 10000) {
        const status = JsonStore.getStatus();
        console.log("Current Status:", status.status, `Analyzed: ${status.assetsAnalyzed}/${status.totalAssets}`);
        if (status.status === 'IDLE' && status.assetsAnalyzed > 0) {
            console.log("Sync finished early?");
            break;
        }
        await new Promise(r => setTimeout(r, 1000));
    }

    console.log("Final Status:", JsonStore.getStatus());
}

main().catch(console.error);