Skip to content

Commit

Permalink
Fix expiringTimeNano inconsistent between active and passive (cadence…
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng authored and andrewjdawson2016 committed Jun 11, 2019
1 parent ebcfc29 commit c4a2686
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions service/history/mutableStateBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3056,14 +3056,15 @@ func (e *mutableStateBuilder) AddContinueAsNewEvent(
func rolloverAutoResetPointsWithExpiringTime(
resetPoints *workflow.ResetPoints,
prevRunID string,
nowNano int64,
domainRetentionDays int32,
) *workflow.ResetPoints {

if resetPoints == nil || resetPoints.Points == nil {
return resetPoints
}
newPoints := make([]*workflow.ResetPointInfo, 0, len(resetPoints.Points))
expiringTimeNano := time.Now().Add(time.Duration(domainRetentionDays) * time.Hour * 24).UnixNano()
expiringTimeNano := nowNano + int64(time.Duration(domainRetentionDays)*time.Hour*24)
for _, rp := range resetPoints.Points {
if rp.GetRunId() == prevRunID {
rp.ExpiringTimeNano = common.Int64Ptr(expiringTimeNano)
Expand Down Expand Up @@ -3149,7 +3150,7 @@ func (e *mutableStateBuilder) ReplicateWorkflowExecutionContinuedAsNewEvent(
CronSchedule: startedAttributes.GetCronSchedule(),
EventStoreVersion: newStateBuilder.GetEventStoreVersion(),
BranchToken: newStateBuilder.GetCurrentBranch(),
PreviousAutoResetPoints: rolloverAutoResetPointsWithExpiringTime(startedAttributes.GetPrevAutoResetPoints(), prevRunID, domainRetentionDays),
PreviousAutoResetPoints: rolloverAutoResetPointsWithExpiringTime(startedAttributes.GetPrevAutoResetPoints(), prevRunID, continueAsNewEvent.GetTimestamp(), domainRetentionDays),
}

if continueAsNew.HasRetryPolicy {
Expand Down

0 comments on commit c4a2686

Please sign in to comment.