You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/03/11 23:30:20 UTC

[GitHub] [openwhisk] rabbah commented on a change in pull request #4819: Save waitTime value for sequence and conductor action (allow parent/child transaction ids)

rabbah commented on a change in pull request #4819: Save waitTime value for sequence and conductor action (allow parent/child transaction ids)
URL: https://github.com/apache/openwhisk/pull/4819#discussion_r391326427
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/common/TransactionId.scala
 ##########
 @@ -172,13 +175,22 @@ case class TransactionId private (meta: TransactionMetadata) extends AnyVal {
   def deltaToMarker(startMarker: StartMarker, endTime: Instant = Instant.now(Clock.systemUTC)) =
     Duration.between(startMarker.start, endTime).toMillis
 
+  def hasParent = meta.parent.isDefined
+
   /**
    * Formats log message to include marker.
    *
    * @param message: The log message without the marker
    * @param marker: The marker to add to the message
    */
   private def createMessageWithMarker(message: String, marker: LogMarker): String = s"$message $marker"
+
+  /**
+   * Find root transaction metadata
+   */
+  @tailrec
+  private def findRoot(meta: TransactionMetadata): TransactionMetadata =
+    if (meta.parent.isDefined) findRoot(meta.parent.get) else meta
 
 Review comment:
   avoid `.get` even though it's safe, also clearer to me

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services