diff --git a/src/jobservice/hook/hook_agent.go b/src/jobservice/hook/hook_agent.go index a2db6b917..1a90d307f 100644 --- a/src/jobservice/hook/hook_agent.go +++ b/src/jobservice/hook/hook_agent.go @@ -32,8 +32,6 @@ import ( const ( // Backoff duration of direct retrying. errRetryBackoff = 5 * time.Minute - // Max concurrency of retrying goroutines. - maxConcurrency = 512 ) // Agent is designed to handle the hook events with reasonable numbers of concurrent threads. @@ -74,13 +72,13 @@ type basicAgent struct { } // NewAgent is constructor of basic agent -func NewAgent(ctx *env.Context, ns string, redisPool *redis.Pool) Agent { +func NewAgent(ctx *env.Context, ns string, redisPool *redis.Pool, retryConcurrency uint) Agent { return &basicAgent{ context: ctx.SystemContext, namespace: ns, client: NewClient(ctx.SystemContext), redisPool: redisPool, - tokens: make(chan struct{}, maxConcurrency), + tokens: make(chan struct{}, retryConcurrency), } } diff --git a/src/jobservice/hook/hook_client.go b/src/jobservice/hook/hook_client.go index 1cf6aaf25..6add83978 100644 --- a/src/jobservice/hook/hook_client.go +++ b/src/jobservice/hook/hook_client.go @@ -65,7 +65,7 @@ func NewClient(ctx context.Context) Client { } client := &http.Client{ - Timeout: 15 * time.Second, + Timeout: 30 * time.Second, Transport: transport, } diff --git a/src/jobservice/runtime/bootstrap.go b/src/jobservice/runtime/bootstrap.go index c6573c6fc..4231cad75 100644 --- a/src/jobservice/runtime/bootstrap.go +++ b/src/jobservice/runtime/bootstrap.go @@ -131,7 +131,8 @@ func (bs *Bootstrap) LoadAndRun(ctx context.Context, cancel context.CancelFunc) // Create stats manager manager = mgt.NewManager(ctx, namespace, redisPool) // Create hook agent, it's a singleton object - hookAgent := hook.NewAgent(rootContext, namespace, redisPool) + // the retryConcurrency keep same with worker num + hookAgent := hook.NewAgent(rootContext, namespace, redisPool, workerNum) hookCallback := func(URL string, change *job.StatusChange) error { msg := fmt.Sprintf( "status change: job=%s, status=%s, revision=%d",