mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-15 03:12:36 +03:00
Resynced onto the release tip after #12051/#12052 landed. One real conflict in open-sse/services/combo.ts at both LKGP-clear call sites (handleComboChat + round-robin path): the release tip already has #12013's clearStaleLKGP() helper, which this PR's branch predates — kept the current helper call at both sites, discarding the pre-refactor inline pattern. typecheck:core and the open-sse test suite (vitest, 9/9 on volumeDetector) both green after resync. Thanks for the well-scoped Phase 4 migration.
33 lines
982 B
TypeScript
33 lines
982 B
TypeScript
import { getCloudSyncScheduler } from "@/shared/services/cloudSyncScheduler";
|
|
import { isCloudEnabled } from "@/lib/db/settings";
|
|
import { cleanupProviderConnections } from "@/lib/db/providers";
|
|
|
|
/**
|
|
* Initialize cloud sync scheduler
|
|
* This should be called when the application starts
|
|
*/
|
|
export async function initializeCloudSync() {
|
|
try {
|
|
// Cleanup null fields from existing data
|
|
await cleanupProviderConnections();
|
|
|
|
// Create scheduler instance with default 15-minute interval
|
|
const scheduler = await getCloudSyncScheduler(null, 15);
|
|
|
|
// Start the scheduler
|
|
await scheduler.start();
|
|
|
|
return scheduler;
|
|
} catch (error) {
|
|
console.error("[CloudSync] Error initializing scheduler:", error);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
// For development/testing purposes
|
|
if (typeof require !== "undefined" && require.main === module) {
|
|
initializeCloudSync().catch((err) => console.error("[CloudSync] init failed:", err));
|
|
}
|
|
|
|
export default initializeCloudSync;
|