mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-08 00:02:20 +03:00
This project is inspired by and originally forked from 9router by decolua (https://github.com/decolua/9router). Full rebrand: 9router → OmniRoute across all source code, configuration, Docker, documentation, and assets.
32 lines
897 B
JavaScript
32 lines
897 B
JavaScript
import { getCloudSyncScheduler } from "@/shared/services/cloudSyncScheduler";
|
|
import { isCloudEnabled, cleanupProviderConnections } from "@/lib/localDb";
|
|
|
|
/**
|
|
* 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(console.log);
|
|
}
|
|
|
|
export default initializeCloudSync;
|