653
}
654
656
>
if directive.GetUseAssignmentRules() != nil {
657
// return build ID only if a new one is assigned.
658
assignedBuildId = spoolQueue.QueueKey().Version().BuildId()
659
}
660
662
>
if err == nil {
663
>
spoolQueue.RecordTaskAdd(metrics.TaskAddResultBacklog, forwarded, behavior)
664
>
// We should not use targetVersion because targetVersion is always routing-config-deriven.
665
>
// For pinned workflows, targetVersion is not necessarily the same as the pinned version.
666
>
// Also, note that we use syncMatchQueue's version, and not spoolQueue's version. This is
667
>
// because for unpinned tasks spoolQueue is always the default (unversioned) queue.
668
>
// Unpinned tasks are written to the default queue for late binding, in case target version
669
>
// changes by the time they can be dispatched.
670
>
pm.processTaskAddHooks(ctx, syncMatchQueue.QueueKey().Version().WorkerDeploymentVersionS(), outcome)
671
>
} else {
672
spoolQueue.RecordTaskAdd(taskAddErrResult(err), forwarded, behavior)
673
}
674
676
}
677