Skip to content

Add non-breaking async callback surface to uSyncCallbacks - #1049

Merged
KevinJump merged 1 commit into
v17/mainfrom
feature/async-usync-callbacks
Aug 25, 2026
Merged

Add non-breaking async callback surface to uSyncCallbacks#1049
KevinJump merged 1 commit into
v17/mainfrom
feature/async-usync-callbacks

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

Summary

  • uSyncCallbacks' delegates (Callback, Update, SetRange, IncrementalUpdate, Complete) are void, which forces consumers like uSync.Complete's LocalHubClient/PublisherHubClient to .Wait() on every SignalR send. Adds optional async counterparts (CallbackAsync, UpdateAsync, SetRangeAsync, IncrementalUpdateAsync, CompleteAsync) that can be set alongside the existing sync ones.
  • Adds Raise*Async helper methods on uSyncCallbacks that invoke the sync delegate then await the async one if set, so callers get one call site regardless of which style a consumer wired up.
  • Existing constructors, delegate types, and properties on uSyncCallbacks are untouched — this is purely additive, so it's non-breaking for anything currently calling into it.
  • Updates the call sites that invoke callbacks directly off a uSyncCallbacks instance (SyncService, SyncService_Single, SyncActionService, SyncHandlerRoot, uSyncManagementService) to await the new Raise*Async helpers instead of firing the sync delegate directly.

Not changed (deliberately)

Call sites that extract the raw SyncUpdateCallback delegate to pass into the public ISyncHandler.ExportAllAsync/ReportAsync interface (and SyncMergeOptions/CreateNotificationScope) are left as-is, since changing those public signatures would be a breaking change. This is a follow-up from investigating the "CreateRestorePoint timeout after v17 upgrade" issue — see uSync.Complete PR 178 — and unblocks wiring real per-item/progress callbacks into restore-point export without forcing a blocking .Wait() per SignalR message.

Test plan

  • dotnet build uSync.slnx — succeeds, no new warnings/errors
  • dotnet test uSync.Tests/uSync.Tests.csproj — 141/141 passing

The uSyncCallbacks delegates (Callback, Update, SetRange, IncrementalUpdate,
Complete) were void, which forced consumers like uSync.Complete's
LocalHubClient/PublisherHubClient to .Wait() on every SignalR send.

Add optional async counterparts (CallbackAsync, UpdateAsync, SetRangeAsync,
IncrementalUpdateAsync, CompleteAsync) alongside the existing sync delegates,
plus Raise*Async helper methods that invoke the sync delegate then await the
async one if set. Existing constructors, properties and delegate types are
untouched, so this is purely additive.

Update the call sites that invoke callbacks directly off a uSyncCallbacks
instance (SyncService, SyncService_Single, SyncActionService,
SyncHandlerRoot, uSyncManagementService) to await the new Raise*Async
helpers. Call sites that extract the raw SyncUpdateCallback delegate to pass
into the public ISyncHandler.ExportAllAsync/ReportAsync interface are left
untouched, since changing that interface would be a breaking change.
@KevinJump
KevinJump merged commit 71a56d9 into v17/main Aug 25, 2026
4 checks passed
@KevinJump
KevinJump deleted the feature/async-usync-callbacks branch August 25, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant