MCPcopy Index your code
hub / github.com/bytebase/bytebase / newUnifiedInterceptor

Function newUnifiedInterceptor

action/command/api.go:337–355  ·  view source on GitHub ↗
(config *retryConfig, tokenRefresher func(ctx context.Context) (string, error))

Source from the content-addressed store, hash-verified

335}
336
337func newUnifiedInterceptor(config *retryConfig, tokenRefresher func(ctx context.Context) (string, error)) *unifiedInterceptor {
338 ui := &unifiedInterceptor{
339 tokenMgr: newTokenManager(),
340 tokenRefresher: tokenRefresher,
341 }
342
343 if config != nil && config.maxAttempts > 1 {
344 ui.maxAttempts = config.maxAttempts
345 ui.initialInterval = config.initialInterval
346 ui.maxInterval = config.maxInterval
347 } else {
348 // Default retry config for auth errors
349 ui.maxAttempts = 2
350 ui.initialInterval = 1 * time.Second
351 ui.maxInterval = 1 * time.Second
352 }
353
354 return ui
355}
356
357func (ui *unifiedInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc {
358 return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) {

Callers 1

newClientFunction · 0.85

Calls 1

newTokenManagerFunction · 0.85

Tested by

no test coverage detected