Skip to content

Commit

Permalink
Respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
timl3136 committed Feb 21, 2025
1 parent b7ca226 commit 143b2a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,7 @@ const (
ShardModeHashRing = "hash-ring"
ShardModeShardDistributor = "shard-distributor"
)

const (
StringSizeOverheadBytes = 16
)
4 changes: 3 additions & 1 deletion common/definition/workflowIdentifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

package definition

import "github.com/uber/cadence/common"

type (
// WorkflowIdentifier is the combinations which represent a workflow
WorkflowIdentifier struct {
Expand All @@ -34,7 +36,7 @@ func (wi *WorkflowIdentifier) Size() uint64 {
// Calculate the size of strings in bytes, we assume that all those fields are using ASCII which is 1 byte per char
size := len(wi.DomainID) + len(wi.WorkflowID) + len(wi.RunID)
// Each string internally holds a reference pointer and a length, which are 8 bytes each
stringOverhead := 3 * 16
stringOverhead := 3 * common.StringSizeOverheadBytes
return uint64(size + stringOverhead)
}

Expand Down
1 change: 1 addition & 0 deletions service/history/execution/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,7 @@ func (c *contextImpl) Size() uint64 {
size += len(c.domainID)

size += len(c.workflowExecution.GetWorkflowID()) + len(c.workflowExecution.GetRunID())
size += 3 * common.StringSizeOverheadBytes
size += int(c.shard.Size())

size += 3 * 8 // logger
Expand Down

0 comments on commit 143b2a4

Please sign in to comment.