Skip to content

Commit

Permalink
Measure backlog after completing current task (#4562)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnr authored and mindaugasrukas committed Jun 30, 2023
1 parent 316e876 commit 0fcff51
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion service/matching/matchingEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,9 @@ func (e *matchingEngineImpl) createPollWorkflowTaskQueueResponse(
if task.query != nil {
response.Query = task.query.request.QueryRequest.Query
}
response.BacklogCountHint = task.backlogCountHint
if task.backlogCountHint != nil {
response.BacklogCountHint = task.backlogCountHint()
}
return response
}

Expand Down
2 changes: 1 addition & 1 deletion service/matching/matchingEngine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func (s *matchingEngineSuite) TestPollWorkflowTaskQueues() {
StartedEventId: common.EmptyEventID,
Attempt: 1,
NextEventId: common.EmptyEventID,
BacklogCountHint: 1,
BacklogCountHint: 0,
StickyExecutionEnabled: true,
Query: nil,
TransientWorkflowTask: nil,
Expand Down
2 changes: 1 addition & 1 deletion service/matching/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type (
source enumsspb.TaskSource
forwardedFrom string // name of the child partition this task is forwarded from (empty if not forwarded)
responseC chan error // non-nil only where there is a caller waiting for response (sync-match)
backlogCountHint int64
backlogCountHint func() int64
}
)

Expand Down
2 changes: 1 addition & 1 deletion service/matching/taskQueueManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func (c *taskQueueManagerImpl) GetTask(
}

task.namespace = c.namespace
task.backlogCountHint = c.taskAckManager.getBacklogCountHint()
task.backlogCountHint = c.taskAckManager.getBacklogCountHint
return task, nil
}

Expand Down

0 comments on commit 0fcff51

Please sign in to comment.