Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenquan Xing committed Mar 27, 2018
1 parent a900c2c commit ba98a3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions service/history/historyTestBase.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ func (s *TestShardContext) GetTransferAckLevel() int64 {
s.RLock()
defer s.RUnlock()

// TODO change make this cluster input parameter
// TODO cluster should be an input parameter
cluster := s.GetService().GetClusterMetadata().GetCurrentClusterName()
// if can find corresponding ack level in the cluster to timer ack level map
// if we can find corresponding ack level
if ackLevel, ok := s.shardInfo.ClusterTransferAckLevel[cluster]; ok {
return ackLevel
}
// otherwise, default to existing ack level, which belongs to local cluster
// this can happen if you add more cluster
return s.shardInfo.TransferAckLevel
}

Expand All @@ -153,7 +154,7 @@ func (s *TestShardContext) UpdateTransferAckLevel(ackLevel int64) error {
s.RLock()
defer s.RUnlock()

// TODO change make this cluster input parameter
// TODO cluster should be an input parameter
cluster := s.GetService().GetClusterMetadata().GetCurrentClusterName()
if cluster == s.GetService().GetClusterMetadata().GetCurrentClusterName() {
s.shardInfo.TransferAckLevel = ackLevel
Expand All @@ -172,11 +173,12 @@ func (s *TestShardContext) GetTimerAckLevel(cluster string) time.Time {
s.RLock()
defer s.RUnlock()

// if can find corresponding ack level in the cluster to timer ack level map
// if we can find corresponding ack level
if ackLevel, ok := s.shardInfo.ClusterTimerAckLevel[cluster]; ok {
return ackLevel
}
// otherwise, default to existing ack level, which belongs to local cluster
// this can happen if you add more cluster
return s.shardInfo.TimerAckLevel
}

Expand Down
10 changes: 6 additions & 4 deletions service/history/shardContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ func (s *shardContextImpl) GetTransferAckLevel() int64 {
s.RLock()
defer s.RUnlock()

// TODO change make this cluster input parameter
// TODO cluster should be an input parameter
cluster := s.GetService().GetClusterMetadata().GetCurrentClusterName()
// if can find corresponding ack level in the cluster to timer ack level map
// if we can find corresponding ack level
if ackLevel, ok := s.shardInfo.ClusterTransferAckLevel[cluster]; ok {
return ackLevel
}
// otherwise, default to existing ack level, which belongs to local cluster
// this can happen if you add more cluster
return s.shardInfo.TransferAckLevel
}

Expand All @@ -141,7 +142,7 @@ func (s *shardContextImpl) UpdateTransferAckLevel(ackLevel int64) error {
s.Lock()
defer s.Unlock()

// TODO change make this cluster input parameter
// TODO cluster should be an input parameter
cluster := s.GetService().GetClusterMetadata().GetCurrentClusterName()
if cluster == s.GetService().GetClusterMetadata().GetCurrentClusterName() {
s.shardInfo.TransferAckLevel = ackLevel
Expand All @@ -155,11 +156,12 @@ func (s *shardContextImpl) GetTimerAckLevel(cluster string) time.Time {
s.RLock()
defer s.RUnlock()

// if can find corresponding ack level in the cluster to timer ack level map
// if we can find corresponding ack level
if ackLevel, ok := s.shardInfo.ClusterTimerAckLevel[cluster]; ok {
return ackLevel
}
// otherwise, default to existing ack level, which belongs to local cluster
// this can happen if you add more cluster
return s.shardInfo.TimerAckLevel
}

Expand Down

0 comments on commit ba98a3b

Please sign in to comment.