Skip to content

Commit d5c435d

Browse files
committed
Clarify comments
1 parent b93829f commit d5c435d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/component/component.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,10 @@ func (r *RuntimeSpecs) componentsForInputType(
526526
if componentErr != nil || !inputSpec.Spec.IsolateUnits {
527527
// Components are generally identified by their input type and output name. However, for
528528
// Service Runtime components, there can only ever be a single instance of the component running,
529-
// as a service. So we identify these only by their input type.
529+
// as a service. So we identify these only by their input type. This way, if the output for a service
530+
// component were to change, it would not result in a different ID for that component. By keeping the same
531+
// ID, we prevent the component from being identified as a new one and the corresponding service from being
532+
// unnecessarily stopped and started.
530533
componentID := fmt.Sprintf("%s-%s", inputType, output.Name)
531534
if inputSpec.Spec.Service != nil {
532535
componentID = inputType
@@ -576,9 +579,12 @@ func (r *RuntimeSpecs) componentsForInputType(
576579
} else {
577580
for _, input := range output.Inputs[inputType] {
578581
// Units are being mapped to components, so we need a unique ID for each.
579-
// Components are generally identified by their input type, output name, and input ID. However, for
582+
// Components are generally identified by their input type and output name. However, for
580583
// Service Runtime components, there can only ever be a single instance of the component running,
581-
// as a service. So we identify these only by their input type and input ID.
584+
// as a service. So we identify these only by their input type. This way, if the output for a service
585+
// component were to change, it would not result in a different ID for that component. By keeping the same
586+
// ID, we prevent the component from being identified as a new one and the corresponding service from being
587+
// unnecessarily stopped and started.
582588
componentID := fmt.Sprintf("%s-%s-%s", inputType, output.Name, input.id)
583589
if inputSpec.Spec.Service != nil {
584590
componentID = fmt.Sprintf("%s-%s", inputType, input.id)

0 commit comments

Comments
 (0)