@@ -1902,7 +1902,7 @@ func (ms *MutableStateImpl) ReplicateWorkflowExecutionStartedEvent(
19021902 }
19031903 if event .SourceVersionStamp .GetUseVersioning () && event .SourceVersionStamp .GetBuildId () != "" {
19041904 limit := ms .config .SearchAttributesSizeOfValueLimit (string (ms .namespaceEntry .Name ()))
1905- if err := ms .addBuildIdsWithNoVisibilityTask ([]string {worker_versioning .VersionedBuildIdSearchAttribute (event .SourceVersionStamp .BuildId )}, limit ); err != nil {
1905+ if _ , err := ms .addBuildIdsWithNoVisibilityTask ([]string {worker_versioning .VersionedBuildIdSearchAttribute (event .SourceVersionStamp .BuildId )}, limit ); err != nil {
19061906 return err
19071907 }
19081908 }
@@ -2107,8 +2107,10 @@ func (ms *MutableStateImpl) trackBuildIdFromCompletion(
21072107 if len (toAdd ) == 0 {
21082108 return nil
21092109 }
2110- if err := ms .addBuildIdsWithNoVisibilityTask (toAdd , limits .MaxSearchAttributeValueSize ); err != nil {
2110+ if changed , err := ms .addBuildIdsWithNoVisibilityTask (toAdd , limits .MaxSearchAttributeValueSize ); err != nil {
21112111 return err
2112+ } else if ! changed {
2113+ return nil
21122114 }
21132115 return ms .taskGenerator .GenerateUpsertVisibilityTask ()
21142116}
@@ -2185,16 +2187,16 @@ func (ms *MutableStateImpl) saveBuildIds(buildIds []string, maxSearchAttributeVa
21852187 return nil
21862188}
21872189
2188- func (ms * MutableStateImpl ) addBuildIdsWithNoVisibilityTask (buildIds []string , maxSearchAttributeValueSize int ) error {
2190+ func (ms * MutableStateImpl ) addBuildIdsWithNoVisibilityTask (buildIds []string , maxSearchAttributeValueSize int ) ( bool , error ) {
21892191 existingBuildIds , err := ms .loadBuildIds ()
21902192 if err != nil {
2191- return err
2193+ return false , err
21922194 }
21932195 modifiedBuildIds , added := ms .addBuildIdToLoadedSearchAttribute (existingBuildIds , buildIds )
21942196 if ! added {
2195- return nil
2197+ return false , nil
21962198 }
2197- return ms .saveBuildIds (modifiedBuildIds , maxSearchAttributeValueSize )
2199+ return true , ms .saveBuildIds (modifiedBuildIds , maxSearchAttributeValueSize )
21982200}
21992201
22002202// TODO: we will release the restriction when reset API allow those pending
0 commit comments