From 8ae4eaadc79dbcd5cd7bb97a7b8b446c14e0553a Mon Sep 17 00:00:00 2001 From: Nicu Reut Date: Fri, 19 Nov 2021 11:27:34 +0100 Subject: [PATCH 1/4] [ledger-api-client] - The default command tracking timeout is no longer influenced by the deprecated `deduplication_time` as a deduplication period. changelog_begin ledger-api-client - The default command tracking timeout is no longer influenced by the deprecated `deduplication_time` as a deduplication period. Previously if no timeout was being set in the command and `deduplication_time` was set as the deduplication period then the command tracking timeout was the minimum between the deduplication_time and max tracking timeout. changelog_end --- .../commands/tracker/CommandTracker.scala | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala b/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala index 6e2b4fdb0af3..13fd7078e620 100644 --- a/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala +++ b/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala @@ -255,22 +255,8 @@ private[commands] class CommandTracker[Context]( ) with NoStackTrace } val commandTimeout = submission.value.timeout match { - // The command submission timeout takes precedence. case Some(timeout) => durationOrdering.min(timeout, maximumCommandTimeout) - case None => - commands.deduplicationPeriod match { - // We keep supporting the `deduplication_time` field as the command timeout, - // for historical reasons. - case Commands.DeduplicationPeriod.DeduplicationTime(deduplicationTimeProto) => - val deduplicationTime = Duration.ofSeconds( - deduplicationTimeProto.seconds, - deduplicationTimeProto.nanos.toLong, - ) - durationOrdering.min(deduplicationTime, maximumCommandTimeout) - // All other deduplication periods do not influence the command timeout. - case _ => - maximumCommandTimeout - } + case None => maximumCommandTimeout } val trackingData = TrackingData( commandId = commandId, From d0aa5aceea715fac182a777753a49996b517974d Mon Sep 17 00:00:00 2001 From: Nicu Reut Date: Fri, 19 Nov 2021 11:43:12 +0100 Subject: [PATCH 2/4] Formatting --- .../client/services/commands/tracker/CommandTracker.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala b/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala index 13fd7078e620..3cb31f1ed8fe 100644 --- a/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala +++ b/ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/commands/tracker/CommandTracker.scala @@ -3,10 +3,12 @@ package com.daml.ledger.client.services.commands.tracker +import java.time.{Duration, Instant} + import akka.stream.stage._ import akka.stream.{Attributes, Inlet, Outlet} import com.daml.grpc.{GrpcException, GrpcStatus} -import com.daml.ledger.api.v1.commands.Commands +import com.daml.ledger.api.v1.command_completion_service.Checkpoint import com.daml.ledger.api.v1.completion.Completion import com.daml.ledger.api.v1.ledger_offset.LedgerOffset import com.daml.ledger.client.services.commands.tracker.CommandTracker._ @@ -24,9 +26,6 @@ import com.google.protobuf.empty.Empty import com.google.rpc.status.{Status => StatusProto} import io.grpc.Status import org.slf4j.LoggerFactory -import java.time.{Duration, Instant} - -import com.daml.ledger.api.v1.command_completion_service.Checkpoint import scala.annotation.nowarn import scala.collection.compat._ From 840fbe9dbca9f527460f84c8d361252fc8802624 Mon Sep 17 00:00:00 2001 From: Nicu Reut Date: Fri, 19 Nov 2021 14:39:48 +0100 Subject: [PATCH 3/4] Remove test for usage of deduplication time --- .../commands/CommandTrackerFlowTest.scala | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala b/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala index 48b71cc9a5b1..478dc32bdc9c 100644 --- a/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala +++ b/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala @@ -329,31 +329,6 @@ class CommandTrackerFlowTest succeed } - "use the command deduplication time, if provided" in { - val Handle(submissions, results, _, _) = runCommandTrackingFlow(allSubmissionsSuccessful) - - val deduplicationTime = DurationProto.of(0, 200000000) // 200ms - submissions.sendNext( - Ctx( - context, - CommandSubmission( - Commands( - commandId = commandId, - submissionId = submissionId, - deduplicationPeriod = - Commands.DeduplicationPeriod.DeduplicationTime(deduplicationTime), - ) - ), - ) - ) - - results.expectNext( - 500.milliseconds, - Ctx(context, Left(CompletionResponse.TimeoutResponse(commandId))), - ) - succeed - } - "cap the timeout at the maximum command timeout" in { val Handle(submissions, results, _, _) = runCommandTrackingFlow( allSubmissionsSuccessful, From 7c4ae775fe62174aa0f294226665e8d67ee111e4 Mon Sep 17 00:00:00 2001 From: Nicu Reut Date: Fri, 19 Nov 2021 14:48:17 +0100 Subject: [PATCH 4/4] Format imports --- .../ledger/client/services/commands/CommandTrackerFlowTest.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala b/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala index 478dc32bdc9c..95722902acb5 100644 --- a/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala +++ b/ledger/ledger-api-client/src/test/suite/scala/com/digitalasset/ledger/client/services/commands/CommandTrackerFlowTest.scala @@ -29,7 +29,6 @@ import com.daml.ledger.client.services.commands.tracker.CompletionResponse.{ } import com.daml.ledger.client.services.commands.tracker.{CompletionResponse, TrackedCommandKey} import com.daml.util.Ctx -import com.google.protobuf.duration.{Duration => DurationProto} import com.google.protobuf.empty.Empty import com.google.protobuf.timestamp.Timestamp import com.google.rpc.code._