Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,10 @@ func (wh *WorkflowHandler) ListOpenWorkflowExecutions(ctx context.Context, reque
return nil, wh.error(errStartTimeFilterNotSet, scope)
}

if timestamp.TimeValue(request.GetStartTimeFilter().GetLatestTime()).IsZero() {
request.GetStartTimeFilter().LatestTime = timestamp.TimeNowPtrUtc()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time.max() instead of Time.now() because of possible clock skew?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if it might also make sense

  • to have the frontend just leave the values as is, and
  • to let whoever is actually handling the request to interpret IsZero values as "no upper bound", and produce the data accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Whoever" is persistence layer and we have 4 different calls to it. I will have to modify it in 4 places, or just one (here). I agree frontend handler is not a best place for it. Although all our validation/default logic is in frontend.

}

if timestamp.TimeValue(request.StartTimeFilter.GetEarliestTime()).After(timestamp.TimeValue(request.StartTimeFilter.GetLatestTime())) {
return nil, wh.error(errEarliestTimeIsGreaterThanLatestTime, scope)
}
Expand Down Expand Up @@ -2439,6 +2443,10 @@ func (wh *WorkflowHandler) ListClosedWorkflowExecutions(ctx context.Context, req
return nil, wh.error(errStartTimeFilterNotSet, scope)
}

if timestamp.TimeValue(request.GetStartTimeFilter().GetLatestTime()).IsZero() {
request.GetStartTimeFilter().LatestTime = timestamp.TimeNowPtrUtc()
}

if timestamp.TimeValue(request.StartTimeFilter.GetEarliestTime()).After(timestamp.TimeValue(request.StartTimeFilter.GetLatestTime())) {
return nil, wh.error(errEarliestTimeIsGreaterThanLatestTime, scope)
}
Expand Down