Skip to content

Commit

Permalink
Add timer notification and logs. (cadence-workflow#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
sivakku authored Mar 3, 2017
1 parent b31fa7a commit 1eb6ea1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,16 @@ Update_History_Loop:
return nil, err
}
timerTasks = append(timerTasks, start2CloseTimeoutTask)
defer e.timerProcessor.NotifyNewTimer(start2CloseTimeoutTask.GetTaskID())

start2HeartBeatTimeoutTask, err := context.tBuilder.AddHeartBeatActivityTimeout(scheduleID, msBuilder)
if err != nil {
return nil, err
}
if start2HeartBeatTimeoutTask != nil {
timerTasks = append(timerTasks, start2HeartBeatTimeoutTask)
defer e.timerProcessor.NotifyNewTimer(start2HeartBeatTimeoutTask.GetTaskID())
}
defer e.timerProcessor.NotifyNewTimer(start2CloseTimeoutTask.GetTaskID())

ai.StartedID = event.GetEventId()
ai.RequestID = requestID
Expand Down Expand Up @@ -462,14 +464,15 @@ Update_History_Loop:
Schedule2StartTimeoutTask := context.tBuilder.AddScheduleToStartActivityTimeout(
scheduleEvent.GetEventId(), scheduleEvent, msBuilder)
timerTasks = append(timerTasks, Schedule2StartTimeoutTask)
defer e.timerProcessor.NotifyNewTimer(Schedule2StartTimeoutTask.GetTaskID())

Schedule2CloseTimeoutTask, err := context.tBuilder.AddScheduleToCloseActivityTimeout(
scheduleEvent.GetEventId(), msBuilder)
if err != nil {
return err
}
timerTasks = append(timerTasks, Schedule2CloseTimeoutTask)
defer e.timerProcessor.NotifyNewTimer(Schedule2StartTimeoutTask.GetTaskID())
defer e.timerProcessor.NotifyNewTimer(Schedule2CloseTimeoutTask.GetTaskID())

case workflow.DecisionType_CompleteWorkflowExecution:
if isComplete || builder.hasPendingTasks() {
Expand Down
3 changes: 2 additions & 1 deletion service/history/timerBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ func (tb *timerBuilder) AddActivityTimeoutTask(scheduleID int64,
}

timeOutTask := tb.createActivityTimeoutTask(fireTimeout, timeoutType, scheduleID)
tb.logger.Debugf("Adding Activity Timeout: %+v", timeOutTask)
tb.logger.Debugf("Adding Activity Timeout: SequenceID: %v, TimeoutType: %v, EventID: %v",
SequenceID(timeOutTask.TaskID), timeoutType.String(), timeOutTask.EventID)
return timeOutTask
}

Expand Down
4 changes: 3 additions & 1 deletion service/history/timerQueueProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ func (t *timerQueueProcessorImpl) processTimerTask(key SequenceID) error {
return fmt.Errorf("The key didn't match - SequenceID: %d, found task: %v", key, timerTask)
}

t.logger.Debugf("Processing found timer: %s, timer: %+v", SequenceID(timerTask.TaskID), timerTask)
t.logger.Debugf("Processing found timer: %s, for WorkflowID: %v, RunID: %v, Type: %v, TimeoutTupe: %v, EventID: %v",
SequenceID(timerTask.TaskID), timerTask.WorkflowID, timerTask.RunID, timerTask.TaskType,
workflow.TimeoutType(timerTask.TimeoutType).String(), timerTask.EventID)

workflowExecution := workflow.WorkflowExecution{
WorkflowId: common.StringPtr(timerTask.WorkflowID),
Expand Down

0 comments on commit 1eb6ea1

Please sign in to comment.