From dbc231d5f38f80dd3cf6cd452aca9e0d0255f722 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Fri, 5 Dec 2025 09:06:34 +0800 Subject: [PATCH] =?UTF-8?q?Updata:=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/file/file.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/service/file/file.go b/pkg/service/file/file.go index 57361a9..d9bac54 100644 --- a/pkg/service/file/file.go +++ b/pkg/service/file/file.go @@ -2,6 +2,7 @@ package file import ( "bytes" + "context" "errors" "fonchain-fiee/api/files" "fonchain-fiee/pkg/service" @@ -292,7 +293,11 @@ func SecurityScan(ctx *gin.Context) { } //后台异步执行扫描 go func() { - _, err := service.FilesProvider.SecurityScan(ctx, &req) + + // 使用独立的 context,避免原请求 context 被取消 + scanCtx := context.Background() + // 执行安全扫描 + _, err := service.FilesProvider.SecurityScan(scanCtx, &req) if err != nil { // 记录错误日志 zap.L().Error("安全扫描失败",