mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 08:12:26 -05:00 
			
		
		
		
	[chore] Bump all otel deps (#3241)
This commit is contained in:
		
					parent
					
						
							
								291bb68b47
							
						
					
				
			
			
				commit
				
					
						28d57d1f13
					
				
			
		
					 193 changed files with 13714 additions and 2346 deletions
				
			
		
							
								
								
									
										32
									
								
								vendor/google.golang.org/grpc/service_config.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								vendor/google.golang.org/grpc/service_config.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -26,6 +26,7 @@ import ( | |||
| 	"time" | ||||
| 
 | ||||
| 	"google.golang.org/grpc/balancer" | ||||
| 	"google.golang.org/grpc/balancer/pickfirst" | ||||
| 	"google.golang.org/grpc/codes" | ||||
| 	"google.golang.org/grpc/internal" | ||||
| 	"google.golang.org/grpc/internal/balancer/gracefulswitch" | ||||
|  | @ -163,16 +164,18 @@ type jsonSC struct { | |||
| } | ||||
| 
 | ||||
| func init() { | ||||
| 	internal.ParseServiceConfig = parseServiceConfig | ||||
| 	internal.ParseServiceConfig = func(js string) *serviceconfig.ParseResult { | ||||
| 		return parseServiceConfig(js, defaultMaxCallAttempts) | ||||
| 	} | ||||
| } | ||||
| func parseServiceConfig(js string) *serviceconfig.ParseResult { | ||||
| func parseServiceConfig(js string, maxAttempts int) *serviceconfig.ParseResult { | ||||
| 	if len(js) == 0 { | ||||
| 		return &serviceconfig.ParseResult{Err: fmt.Errorf("no JSON service config provided")} | ||||
| 	} | ||||
| 	var rsc jsonSC | ||||
| 	err := json.Unmarshal([]byte(js), &rsc) | ||||
| 	if err != nil { | ||||
| 		logger.Warningf("grpc: unmarshaling service config %s: %v", js, err) | ||||
| 		logger.Warningf("grpc: unmarshalling service config %s: %v", js, err) | ||||
| 		return &serviceconfig.ParseResult{Err: err} | ||||
| 	} | ||||
| 	sc := ServiceConfig{ | ||||
|  | @ -183,12 +186,12 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { | |||
| 	} | ||||
| 	c := rsc.LoadBalancingConfig | ||||
| 	if c == nil { | ||||
| 		name := PickFirstBalancerName | ||||
| 		name := pickfirst.Name | ||||
| 		if rsc.LoadBalancingPolicy != nil { | ||||
| 			name = *rsc.LoadBalancingPolicy | ||||
| 		} | ||||
| 		if balancer.Get(name) == nil { | ||||
| 			name = PickFirstBalancerName | ||||
| 			name = pickfirst.Name | ||||
| 		} | ||||
| 		cfg := []map[string]any{{name: struct{}{}}} | ||||
| 		strCfg, err := json.Marshal(cfg) | ||||
|  | @ -218,8 +221,8 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { | |||
| 			WaitForReady: m.WaitForReady, | ||||
| 			Timeout:      (*time.Duration)(m.Timeout), | ||||
| 		} | ||||
| 		if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { | ||||
| 			logger.Warningf("grpc: unmarshaling service config %s: %v", js, err) | ||||
| 		if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy, maxAttempts); err != nil { | ||||
| 			logger.Warningf("grpc: unmarshalling service config %s: %v", js, err) | ||||
| 			return &serviceconfig.ParseResult{Err: err} | ||||
| 		} | ||||
| 		if m.MaxRequestMessageBytes != nil { | ||||
|  | @ -239,13 +242,13 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { | |||
| 		for i, n := range *m.Name { | ||||
| 			path, err := n.generatePath() | ||||
| 			if err != nil { | ||||
| 				logger.Warningf("grpc: error unmarshaling service config %s due to methodConfig[%d]: %v", js, i, err) | ||||
| 				logger.Warningf("grpc: error unmarshalling service config %s due to methodConfig[%d]: %v", js, i, err) | ||||
| 				return &serviceconfig.ParseResult{Err: err} | ||||
| 			} | ||||
| 
 | ||||
| 			if _, ok := paths[path]; ok { | ||||
| 				err = errDuplicatedName | ||||
| 				logger.Warningf("grpc: error unmarshaling service config %s due to methodConfig[%d]: %v", js, i, err) | ||||
| 				logger.Warningf("grpc: error unmarshalling service config %s due to methodConfig[%d]: %v", js, i, err) | ||||
| 				return &serviceconfig.ParseResult{Err: err} | ||||
| 			} | ||||
| 			paths[path] = struct{}{} | ||||
|  | @ -264,7 +267,7 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { | |||
| 	return &serviceconfig.ParseResult{Config: &sc} | ||||
| } | ||||
| 
 | ||||
| func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPolicy, err error) { | ||||
| func convertRetryPolicy(jrp *jsonRetryPolicy, maxAttempts int) (p *internalserviceconfig.RetryPolicy, err error) { | ||||
| 	if jrp == nil { | ||||
| 		return nil, nil | ||||
| 	} | ||||
|  | @ -278,17 +281,16 @@ func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPol | |||
| 		return nil, nil | ||||
| 	} | ||||
| 
 | ||||
| 	if jrp.MaxAttempts < maxAttempts { | ||||
| 		maxAttempts = jrp.MaxAttempts | ||||
| 	} | ||||
| 	rp := &internalserviceconfig.RetryPolicy{ | ||||
| 		MaxAttempts:          jrp.MaxAttempts, | ||||
| 		MaxAttempts:          maxAttempts, | ||||
| 		InitialBackoff:       time.Duration(jrp.InitialBackoff), | ||||
| 		MaxBackoff:           time.Duration(jrp.MaxBackoff), | ||||
| 		BackoffMultiplier:    jrp.BackoffMultiplier, | ||||
| 		RetryableStatusCodes: make(map[codes.Code]bool), | ||||
| 	} | ||||
| 	if rp.MaxAttempts > 5 { | ||||
| 		// TODO(retry): Make the max maxAttempts configurable. | ||||
| 		rp.MaxAttempts = 5 | ||||
| 	} | ||||
| 	for _, code := range jrp.RetryableStatusCodes { | ||||
| 		rp.RetryableStatusCodes[code] = true | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue