Commit Graph

2 Commits

Author SHA1 Message Date
Warren
65cd68cad4 Implement incremental save for WebDAV versioning
Changes:
1. Added dirty flag to WebDavVersioning to track unsaved changes
2. Modified create_version() to only mark dirty=true instead of immediate save_index()
3. Added flush() method to save dirty index periodically
4. Added background thread in server.rs to flush every 60 seconds
5. Async index loading on startup (spawn thread to avoid blocking OPTIONS/PROPFIND)

Expected performance:
- PUT operations: still fast (dirty flag only, no save_index() blocking)
- Index persistence: flush every 60 seconds (or on shutdown)
- OPTIONS/PROPFIND: no blocking (async index loading)

Test results:
- PUT (31B): 0.053s (53ms) 
- Index loading: async thread started 
- Flush thread: started but blocked by launchd auto-restart ⚠️

Next: Test flush thread in production environment (without launchd)
2026-06-30 05:29:09 +08:00
Warren
86984295bf Fix WebDAV PUT timeout: disable versioning for user WebDAV
Root cause: save_index() serializes entire 31KB db to JSON and writes to disk for every PUT operation (synchronous blocking call).

Fix: Disabled versioning for user WebDAV by changing line 2547 from Some(versioning.clone()) to None.

Performance improvement:
- Before: 2+ minutes timeout
- After: 10-27 milliseconds
- Speedup: 12000x faster

Tested: 31B, 100KB, 1MB files all upload successfully in <30ms
2026-06-30 04:56:37 +08:00