Skip to content

Commit beae3b6

Browse files
author
Tamer Eldeeb
authored
Properly return empty token on empty poll request (#219)
1 parent 27c531e commit beae3b6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

service/frontend/handler.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,19 +331,20 @@ func (wh *WorkflowHandler) PollForDecisionTask(
331331

332332
var history *gen.History
333333
var persistenceToken []byte
334+
var continuation []byte
334335
if matchingResp.IsSetWorkflowExecution() {
335336
// Non-empty response. Get the history
336337
history, persistenceToken, err = wh.getHistory(
337338
info.ID, *matchingResp.GetWorkflowExecution(), matchingResp.GetStartedEventId()+1, defaultHistoryMaxPageSize, nil)
338339
if err != nil {
339340
return nil, wrapError(err)
340341
}
341-
}
342342

343-
continuation, err :=
344-
getSerializedGetHistoryToken(persistenceToken, matchingResp.GetWorkflowExecution().GetRunId(), history, matchingResp.GetStartedEventId()+1)
345-
if err != nil {
346-
return nil, wrapError(err)
343+
continuation, err =
344+
getSerializedGetHistoryToken(persistenceToken, matchingResp.GetWorkflowExecution().GetRunId(), history, matchingResp.GetStartedEventId()+1)
345+
if err != nil {
346+
return nil, wrapError(err)
347+
}
347348
}
348349

349350
return createPollForDecisionTaskResponse(matchingResp, history, continuation), nil

0 commit comments

Comments
 (0)