From e02100e0d5af239d91c560c50c1b663b5600416b Mon Sep 17 00:00:00 2001 From: yangzhongjiao Date: Thu, 10 Oct 2024 09:22:07 +0000 Subject: [PATCH] update vendor --- go.mod | 2 +- go.sum | 2 ++ .../dms/pkg/dms-common/pkg/http/http.go | 15 ++++++++++++++- vendor/modules.txt | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index da4b521e64..8c96b9062c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/Masterminds/semver/v3 v3.1.1 - github.com/actiontech/dms v0.0.0-20241010022353-9b4591e71b26 + github.com/actiontech/dms v0.0.0-20241010085644-dd7513f0051e github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62 github.com/actiontech/mybatis-mapper-2-sql v0.5.1-0.20240806065717-29cde7000ef5 github.com/agiledragon/gomonkey v2.0.2+incompatible diff --git a/go.sum b/go.sum index ceea11dff4..734786ac03 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,8 @@ github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/actiontech/dms v0.0.0-20241010022353-9b4591e71b26 h1:DVUD1u/1vC6yHqj171JCYgyVhFNWlQGp2y/wzKEGhJo= github.com/actiontech/dms v0.0.0-20241010022353-9b4591e71b26/go.mod h1:Jm+tDoBYmX8R8zqgPJRq1NwZXdxO/F+HxVRJVF65WXA= +github.com/actiontech/dms v0.0.0-20241010085644-dd7513f0051e h1:eEnYDdYR3f8lvlUtCI0bfd/vp0QUiJTf8TzGkwvshUw= +github.com/actiontech/dms v0.0.0-20241010085644-dd7513f0051e/go.mod h1:Jm+tDoBYmX8R8zqgPJRq1NwZXdxO/F+HxVRJVF65WXA= github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62 h1:JM7WnLzlvXOGE90KKd+aigi+qUDS+U5dLwQMNpTKZxE= github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62/go.mod h1:adDZHhAf2LRMx2h0JzofPXn12x2XlyQjVE116KXquwo= github.com/actiontech/mybatis-mapper-2-sql v0.5.1-0.20240806065717-29cde7000ef5 h1:vyQVrkYPzUV9d7gSvOWoezwWMTiC4jc3f3Hpianefq0= diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go b/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go index 380399efdd..b23811a903 100644 --- a/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go +++ b/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go @@ -58,6 +58,11 @@ func POST(ctx context.Context, url string, headers map[string]string, body, out } func Call(ctx context.Context, method, url string, headers map[string]string, body, out interface{}) error { + // 获取上下文中的超时值,并将其断言为 int64 类型 + timeout, ok := ctx.Value(timeoutKey).(int64) + if !ok { + timeout = 15 // 默认超时时间 + } var bodyReader io.Reader if body != nil { bodyJson, err := json.Marshal(body) @@ -77,7 +82,7 @@ func Call(ctx context.Context, method, url string, headers map[string]string, bo req.Header.Set("Content-Type", "application/json") client := http.Client{ - Timeout: time.Second * 15, + Timeout: time.Second * time.Duration(timeout), } resp, err := client.Do(req) if err != nil { @@ -100,3 +105,11 @@ func Call(ctx context.Context, method, url string, headers map[string]string, bo } return nil } + +type contextKey string + +const timeoutKey contextKey = "timeoutKey" + +func SetTimeoutValueContext(ctx context.Context, timeout int64) context.Context { + return context.WithValue(ctx, timeoutKey, timeout) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 8e12ebc06b..d3cc03a0a8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -53,7 +53,7 @@ github.com/StackExchange/wmi # github.com/acomagu/bufpipe v1.0.4 ## explicit; go 1.12 github.com/acomagu/bufpipe -# github.com/actiontech/dms v0.0.0-20241010022353-9b4591e71b26 +# github.com/actiontech/dms v0.0.0-20241010085644-dd7513f0051e ## explicit; go 1.19 github.com/actiontech/dms/pkg/dms-common/api/accesstoken github.com/actiontech/dms/pkg/dms-common/api/base/v1