969
priorityKey priorityKey,
970
n int,
972
>
// priorityKey could be zero here if we're tracking dispatched tasks (i.e. called from PollTask)
973
>
// and the poll was forwarded so we have a "started" task. We don't return the priority with the
974
>
// started task info so it's not available here. Use the default priority to avoid confusion
975
>
// even though it may not be accurate.
976
>
// TODO: either return priority with the started task, or do this tracking on the node where the
977
>
// match happened, so we have the right value here.
978
>
if priorityKey == 0 {
979
priorityKey = c.config.DefaultPriorityKey
980
}
981
983
>
defer c.taskTrackerLock.Unlock()
984
>
985
>
tracker, ok := intervals[priorityKey]
986
>
if !ok {
987
>
// Initialize all task trackers together; or the timeframes won't line up.
988
>
c.tasksAdded[priorityKey] = c.partitionMgr.engine.newTaskTracker()
989
>
c.tasksDispatched[priorityKey] = c.partitionMgr.engine.newTaskTracker()
990
>
tracker = intervals[priorityKey]
991
>
}
992
>
tracker.inc(n)
993
}
994