|
|
|
@ -10,7 +10,18 @@ type EvolutionGroup = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export class GroupSyncService {
|
|
|
|
|
private static readonly SYNC_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
|
|
|
private static get SYNC_INTERVAL_MS(): number {
|
|
|
|
|
const interval = process.env.GROUP_SYNC_INTERVAL_MS
|
|
|
|
|
? Number(process.env.GROUP_SYNC_INTERVAL_MS)
|
|
|
|
|
: 24 * 60 * 60 * 1000; // Default 24 hours
|
|
|
|
|
|
|
|
|
|
// Ensure minimum 10 second interval in development
|
|
|
|
|
if (process.env.NODE_ENV === 'development' && interval < 10000) {
|
|
|
|
|
console.warn(`Sync interval too low (${interval}ms), using 10s minimum`);
|
|
|
|
|
return 10000;
|
|
|
|
|
}
|
|
|
|
|
return interval;
|
|
|
|
|
}
|
|
|
|
|
private static lastSyncAttempt = 0;
|
|
|
|
|
|
|
|
|
|
static async syncGroups(): Promise<{ added: number; updated: number }> {
|
|
|
|
|