feat: 知识库复制时添加租户信息到上下文
This commit is contained in:
@@ -5232,6 +5232,14 @@ func (s *knowledgeService) ProcessKBClone(ctx context.Context, t *asynq.Task) er
|
|||||||
// Add tenant ID to context
|
// Add tenant ID to context
|
||||||
ctx = context.WithValue(ctx, types.TenantIDContextKey, payload.TenantID)
|
ctx = context.WithValue(ctx, types.TenantIDContextKey, payload.TenantID)
|
||||||
|
|
||||||
|
// Get tenant info and add to context
|
||||||
|
tenantInfo, err := s.tenantRepo.GetTenantByID(ctx, payload.TenantID)
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf(ctx, "Failed to get tenant info: %v", err)
|
||||||
|
return fmt.Errorf("failed to get tenant info: %w", err)
|
||||||
|
}
|
||||||
|
ctx = context.WithValue(ctx, types.TenantInfoContextKey, tenantInfo)
|
||||||
|
|
||||||
// Check if this is the last retry
|
// Check if this is the last retry
|
||||||
retryCount, _ := asynq.GetRetryCount(ctx)
|
retryCount, _ := asynq.GetRetryCount(ctx)
|
||||||
maxRetry, _ := asynq.GetMaxRetry(ctx)
|
maxRetry, _ := asynq.GetMaxRetry(ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user