fix: reduce auto-save frequency to avoid excessive writes
Increase CRDT DB persist debounce from 2s to 30s since it's only needed for crash recovery (CRDT handles real-time sync). Increase LocalStorage draft save debounce from 1s to 5s. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ec053d8126
commit
2d0c3b6df6
|
|
@ -46,8 +46,8 @@ import type { FlowchartData, FlowchartNode, FlowchartEdge, Character, Variable,
|
||||||
// LocalStorage key prefix for draft saves
|
// LocalStorage key prefix for draft saves
|
||||||
const DRAFT_KEY_PREFIX = 'vnwrite-draft-'
|
const DRAFT_KEY_PREFIX = 'vnwrite-draft-'
|
||||||
|
|
||||||
// Debounce delay in ms
|
// Debounce delay for LocalStorage draft saves
|
||||||
const AUTOSAVE_DEBOUNCE_MS = 1000
|
const AUTOSAVE_DEBOUNCE_MS = 5000
|
||||||
|
|
||||||
type ContextMenuState = {
|
type ContextMenuState = {
|
||||||
x: number
|
x: number
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import * as Y from 'yjs'
|
||||||
import type { RealtimeChannel } from '@supabase/supabase-js'
|
import type { RealtimeChannel } from '@supabase/supabase-js'
|
||||||
import type { FlowchartNode, FlowchartEdge } from '@/types/flowchart'
|
import type { FlowchartNode, FlowchartEdge } from '@/types/flowchart'
|
||||||
|
|
||||||
const PERSIST_DEBOUNCE_MS = 2000
|
const PERSIST_DEBOUNCE_MS = 30_000 // 30s - DB persist is for crash recovery only; CRDT handles real-time sync
|
||||||
const BROADCAST_EVENT = 'yjs-update'
|
const BROADCAST_EVENT = 'yjs-update'
|
||||||
|
|
||||||
export type CRDTCallbacks = {
|
export type CRDTCallbacks = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue