projectHistorySyncState holds one document per project that has been resynced: the state of the current or last resync, when project-history rebuilds a project’s history from what web and docstore hold. It is owned by project-history and has no Mongoose schema; the code is the SyncState class and its helpers in services/project-history/app/js/SyncManager.js.
Fields
Who Writes It
A resync is started by project-history
POST /project/:project_id/resync (HttpController.js:950-994), by the retry cron jobs (services/project-history/app/js/RetryManager.js:156-179, server-ce/config/crontab-history), and by project-history itself when processing updates needs one (UpdatesProcessor.js:75, 224).
Who Reads It
Indexes
Notes
- A resync is running while
resyncProjectStructureistrueorresyncDocContentsis not empty (SyncManager.js:565-567). It counts as stuck after 4 hours, and as permanently stuck after 5 clears (SyncManager.js:43-44,569-585). - When a resync finishes, project-history also sets
overleaf.history.lastResyncedAton the project (SyncManager.js:239-248).

