put firstEventID as part of nextPageToken
@@ -67,6 +67,7 @@ type (
getHistoryContinuationToken struct {
RunID string
+ FirstEventID int64
NextEventID int64
PersistenceToken []byte
}
@@ -418,6 +419,7 @@ func (wh *WorkflowHandler) PollForDecisionTask(
persistenceToken,
*matchingResp.WorkflowExecution.RunId,
history,
+ firstEventID,
nextEventID)
if err != nil {
return nil, wh.error(err, scope)
@@ -766,6 +768,7 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory(
DomainUUID: common.StringPtr(info.ID),
Execution: getRequest.Execution,
})
+ token.FirstEventID = common.FirstEventID
if err == nil {
token.NextEventID = *response.EventId
token.RunID = *response.RunId
@@ -792,17 +795,17 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory(
RunId: common.StringPtr(token.RunID),
}
history, persistenceToken, err :=
- wh.getHistory(info.ID, we, common.FirstEventID, token.NextEventID, *getRequest.MaximumPageSize, token.PersistenceToken)
+ wh.getHistory(info.ID, we, token.FirstEventID, token.NextEventID, *getRequest.MaximumPageSize, token.PersistenceToken)
if err != nil {
return nil, wh.error(err, scope)
}
- nextToken, err := getSerializedGetHistoryToken(persistenceToken, token.RunID, history, token.NextEventID)
+ nextToken, err := getSerializedGetHistoryToken(persistenceToken, token.RunID, history, token.FirstEventID, token.NextEventID)
if err != nil {
return nil, wh.error(err, scope)
}
- return createGetWorkflowExecutionHistoryResponse(history, token.NextEventID, nextToken), nil
+ return createGetWorkflowExecutionHistoryResponse(history, nextToken), nil
}
// SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in
@@ -1372,7 +1375,7 @@ func (wh *WorkflowHandler) createPollForDecisionTaskResponse(ctx context.Context
}
func createGetWorkflowExecutionHistoryResponse(
- history *gen.History, nextEventID int64, nextPageToken []byte) *gen.GetWorkflowExecutionHistoryResponse {
+ history *gen.History, nextPageToken []byte) *gen.GetWorkflowExecutionHistoryResponse {
resp := &gen.GetWorkflowExecutionHistoryResponse{}
resp.History = history
resp.NextPageToken = nextPageToken
@@ -1386,7 +1389,7 @@ func deserializeGetHistoryToken(data []byte) (*getHistoryContinuationToken, erro
return &token, err
}
-func getSerializedGetHistoryToken(persistenceToken []byte, runID string, history *gen.History, nextEventID int64) ([]byte, error) {
+func getSerializedGetHistoryToken(persistenceToken []byte, runID string, history *gen.History, firstEventID, nextEventID int64) ([]byte, error) {
// create token if there are more events to read
if history == nil {
return nil, nil
@@ -1395,6 +1398,7 @@ func getSerializedGetHistoryToken(persistenceToken []byte, runID string, history
if len(persistenceToken) > 0 && len(events) > 0 && *events[len(events)-1].EventId < nextEventID-1 {
token := &getHistoryContinuationToken{
RunID: runID,
+ FirstEventID: firstEventID,
NextEventID: nextEventID,
PersistenceToken: persistenceToken,
}
