fix: adjust sync probability and enable requestSync in DocumentSchema
- Reduced the background sync probability from 0.1% to 0.01% to minimize unnecessary sync attempts. - Enabled the requestSync flag in the payload to ensure synchronization requests are properly handled. These changes aim to optimize the background synchronization process within the DocumentSchema, enhancing performance and control over sync operations.
This commit is contained in:
@@ -750,7 +750,7 @@ export class DocumentSchema extends PothosSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only perform background check with a very low probability
|
// Only perform background check with a very low probability
|
||||||
const SYNC_PROBABILITY = 0.01; // 0.1% chance
|
const SYNC_PROBABILITY = 0.001; // 0.1% chance
|
||||||
const SYNC_INTERVAL_MS = 15000; // 15 seconds minimum between syncs
|
const SYNC_INTERVAL_MS = 15000; // 15 seconds minimum between syncs
|
||||||
|
|
||||||
const syncKey = `document:sync:${payload.documentId}:${payload.pageIndex}`;
|
const syncKey = `document:sync:${payload.documentId}:${payload.pageIndex}`;
|
||||||
@@ -775,6 +775,8 @@ export class DocumentSchema extends PothosSchema {
|
|||||||
// ctx
|
// ctx
|
||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
payload.requestSync = true;
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: error is any
|
// biome-ignore lint/suspicious/noExplicitAny: error is any
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
Logger.error("Background sync check failed", {
|
Logger.error("Background sync check failed", {
|
||||||
|
|||||||
Reference in New Issue
Block a user