Sync: Fix SyncBootStateAccessor to use ILastSyncedManager to prevent unnecessary cold boots#21109
Conversation
Update SyncBootStateAccessor to use the new ILastSyncedManager interface instead of the deprecated LastSyncedFileManager, which was causing cold boots to be triggered every time. - Replace LastSyncedFileManager field with ILastSyncedManager - Add new primary constructor accepting ILastSyncedManager - Add obsolete constructors for backwards compatibility using StaticServiceProvider - Update GetSyncBootState to use GetLastSyncedExternalAsync 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add integration tests to verify SyncBootStateAccessor correctly determines cold boot vs warm boot state based on ILastSyncedManager. - Test cold boot when no last synced ID exists - Test warm boot when last synced external ID matches a cache instruction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in SyncBootStateAccessor where it was using the deprecated file-based LastSyncedFileManager instead of the new database-backed ILastSyncedManager. This caused the system to incorrectly trigger cold boots every time because the last synced ID was never persisted to the database.
Key changes:
- Updated
SyncBootStateAccessorto useILastSyncedManagerinterface for database-backed persistence - Added backward-compatible obsolete constructors to avoid breaking existing code
- Implemented comprehensive integration tests to verify cold boot and warm boot behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Umbraco.Infrastructure/Sync/SyncBootStateAccessor.cs |
Replaced LastSyncedFileManager field with ILastSyncedManager, updated constructor to accept new dependency, added two obsolete constructors for backward compatibility, modified GetSyncBootState() to call async method synchronously using established pattern |
tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Sync/SyncBootStateAccessorTest.cs |
Added new integration test file with two test cases: one verifying cold boot when no last synced ID exists, and one verifying warm boot when valid last synced ID exists with corresponding cache instruction |
AndyButland
left a comment
There was a problem hiding this comment.
Looks good and tests out as expected - I'm no longer seeing the repeated cold boots on startup.
…unnecessary cold boots (#21109) * Sync: Fix SyncBootStateAccessor to use ILastSyncedManager Update SyncBootStateAccessor to use the new ILastSyncedManager interface instead of the deprecated LastSyncedFileManager, which was causing cold boots to be triggered every time. - Replace LastSyncedFileManager field with ILastSyncedManager - Add new primary constructor accepting ILastSyncedManager - Add obsolete constructors for backwards compatibility using StaticServiceProvider - Update GetSyncBootState to use GetLastSyncedExternalAsync 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Sync: Add integration tests for SyncBootStateAccessor Add integration tests to verify SyncBootStateAccessor correctly determines cold boot vs warm boot state based on ILastSyncedManager. - Test cold boot when no last synced ID exists - Test warm boot when last synced external ID matches a cache instruction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
|
This pull request has been mentioned on Umbraco community forum. There might be relevant details there: https://forum.umbraco.com/t/cold-starts-after-upgrading-to-umbraco-17/6961/6 |
Summary
SyncBootStateAccessorto use the newILastSyncedManagerinterface instead of the deprecatedLastSyncedFileManagerLastSyncedFileManagerwas not being updatedStaticServiceProviderto avoid breaking changesTest plan
dotnet test --filter "FullyQualifiedName~SyncBootStateAccessorTest"🤖 Generated with Claude Code