check tokens more aggressively when doing operations

This commit is contained in:
Adam Hathcock
2025-02-13 10:50:12 +00:00
parent 2756555eb9
commit ea9768b1f2
2 changed files with 6 additions and 0 deletions
@@ -26,6 +26,7 @@ public sealed class ReceiveOperation(
)
{
using var execute = activityFactory.Start("Receive Operation");
cancellationToken.ThrowIfCancellationRequested();
execute?.SetTag("receiveInfo", receiveInfo);
// 2 - Check account exist
Account account = accountService.GetAccountWithServerUrlFallback(receiveInfo.AccountId, receiveInfo.ServerUrl);
@@ -34,6 +35,7 @@ public sealed class ReceiveOperation(
var version = await apiClient.Version.Get(receiveInfo.SelectedVersionId, receiveInfo.ProjectId, cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
var commitObject = await threadContext.RunOnWorkerAsync(
() => ReceiveData(account, version, receiveInfo, onOperationProgressed, cancellationToken)
);
@@ -47,6 +49,7 @@ public sealed class ReceiveOperation(
)
.ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
await apiClient.Version.Received(
new(version.id, receiveInfo.ProjectId, receiveInfo.SourceApplication),
cancellationToken
@@ -31,8 +31,10 @@ public sealed class SendOperation<T>(
CancellationToken ct = default
)
{
ct.ThrowIfCancellationRequested();
var buildResult = await rootObjectBuilder.Build(objects, sendInfo, onOperationProgressed, ct);
ct.ThrowIfCancellationRequested();
// POC: Jonathon asks on behalf of willow twin - let's explore how this can work
// buildResult.RootObject["@report"] = new Report { ConversionResults = buildResult.ConversionResults };
@@ -42,6 +44,7 @@ public sealed class SendOperation<T>(
var (rootObjId, convertedReferences) = await threadContext.RunOnWorkerAsync(
() => Send(buildResult.RootObject, sendInfo, onOperationProgressed, ct)
);
ct.ThrowIfCancellationRequested();
return new(rootObjId, convertedReferences, buildResult.ConversionResults);
}