Skip to content

Commit

Permalink
Open Record Fix: write open record when workflow starts (cadence-work…
Browse files Browse the repository at this point in the history
…flow#1669)

* Write open record when workflow start

* Add execution time to visibility

* Write start event to cache in ReplicateWorkflowExecutionStartedEvent
  • Loading branch information
yycptt authored Apr 9, 2019
1 parent af7d7ee commit 0bd9676
Show file tree
Hide file tree
Showing 46 changed files with 826 additions and 306 deletions.
4 changes: 2 additions & 2 deletions .gen/go/shared/idl.go

Large diffs are not rendered by default.

48 changes: 46 additions & 2 deletions .gen/go/shared/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions common/cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ func GetBackoffForNextSchedule(cronSchedule string, nowTime time.Time) time.Dura
roundedInterval := time.Second * time.Duration(math.Ceil(backoffInterval.Seconds()))
return roundedInterval
}

// GetBackoffForNextScheduleInSeconds calculates the backoff time in seconds for the
// next run given a cronSchedule and current time
func GetBackoffForNextScheduleInSeconds(cronSchedule string, nowTime time.Time) int32 {
backoffDuration := GetBackoffForNextSchedule(cronSchedule, nowTime)
if backoffDuration == NoBackoff {
return 0
}
return int32(math.Ceil(backoffDuration.Seconds()))
}
2 changes: 2 additions & 0 deletions common/elasticsearch/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
RunID = "RunID"
WorkflowType = "WorkflowType"
StartTime = "StartTime"
ExecutionTime = "ExecutionTime"
CloseTime = "CloseTime"
CloseStatus = "CloseStatus"
HistoryLength = "HistoryLength"
Expand All @@ -50,6 +51,7 @@ var (
RunID: struct{}{},
WorkflowType: struct{}{},
StartTime: struct{}{},
ExecutionTime: struct{}{},
CloseTime: struct{}{},
CloseStatus: struct{}{},
HistoryLength: struct{}{},
Expand Down
Loading

0 comments on commit 0bd9676

Please sign in to comment.