Skip to content

Commit

Permalink
Revert to Send1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Nov 26, 2024
1 parent 7c346a3 commit 1c7354f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Sdk/Speckle.Connectors.Common/Operations/RootObjectSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Speckle.Sdk.Credentials;
using Speckle.Sdk.Logging;
using Speckle.Sdk.Models;
using Speckle.Sdk.Serialisation;
using Speckle.Sdk.Serialisation.V2.Send;
using Speckle.Sdk.Transports;

Expand All @@ -20,6 +21,7 @@ namespace Speckle.Connectors.Common.Operations;
[GenerateAutoInterface]
public sealed class RootObjectSender : IRootObjectSender
{
private readonly IServerTransportFactory _transportFactory;
private readonly ISendConversionCache _sendConversionCache;
private readonly AccountService _accountService;
private readonly IProgressDisplayManager _progressDisplayManager;
Expand All @@ -33,7 +35,8 @@ public RootObjectSender(
IProgressDisplayManager progressDisplayManager,
IOperations operations,
IClientFactory clientFactory,
ISdkActivityFactory activityFactory
ISdkActivityFactory activityFactory,
IServerTransportFactory transportFactory
)
{
_sendConversionCache = sendConversionCache;
Expand All @@ -42,6 +45,7 @@ ISdkActivityFactory activityFactory
_operations = operations;
_clientFactory = clientFactory;
_activityFactory = activityFactory;
_transportFactory = transportFactory;
}

/// <summary>
Expand All @@ -65,13 +69,13 @@ public async Task<SerializeProcessResults> Send(
using var activity = _activityFactory.Start("SendOperation");

string previousSpeed = string.Empty;
using var transport = _transportFactory.Create(account, sendInfo.ProjectId, 60, null);
_progressDisplayManager.Begin();
var sendResult = await _operations
.Send2(
sendInfo.ServerUrl,
sendInfo.ProjectId,
account.token,
var send1Results = await _operations
.Send(
commitObject,
transport,
true,
onProgressAction: new PassthroughProgress(args =>
{
if (args.ProgressEvent == ProgressEvent.UploadBytes)
Expand Down Expand Up @@ -110,6 +114,10 @@ public async Task<SerializeProcessResults> Send(
)
.ConfigureAwait(false);

var sendResult = new SerializeProcessResults(
send1Results.rootObjId,
send1Results.convertedReferences.ToDictionary(x => new Id(x.Key), x => x.Value)
);
_sendConversionCache.StoreSendResult(sendInfo.ProjectId, sendResult.ConvertedReferences);

ct.ThrowIfCancellationRequested();
Expand Down

0 comments on commit 1c7354f

Please sign in to comment.