feat: 知识库复制时添加租户信息到上下文

This commit is contained in:
wizardchen
2025-12-17 19:54:29 +08:00
committed by lyingbug
parent b110082b0f
commit 942689783f
@@ -5232,6 +5232,14 @@ func (s *knowledgeService) ProcessKBClone(ctx context.Context, t *asynq.Task) er
// Add tenant ID to context
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
retryCount, _ := asynq.GetRetryCount(ctx)
maxRetry, _ := asynq.GetMaxRetry(ctx)