feat: add time out when register
@@ -70,7 +70,9 @@ func newStreamPeerTask(ctx context.Context,
logger.Debugf("request overview, pid: %s, url: %s, filter: %s, meta: %s, tag: %s",
request.PeerId, request.Url, request.UrlMeta.Filter, request.UrlMeta, request.UrlMeta.Tag)
// trace register
- regCtx, regSpan := tracer.Start(ctx, config.SpanRegisterTask)
+ regCtx, cancel := context.WithTimeout(ctx, schedulerOption.ScheduleTimeout.Duration)
+ defer cancel()
+ regCtx, regSpan := tracer.Start(regCtx, config.SpanRegisterTask)
logger.Infof("step 1: peer %s start to register", request.PeerId)
result, err := schedulerClient.RegisterPeerTask(regCtx, request)
regSpan.RecordError(err)
@@ -78,7 +80,10 @@ func newStreamPeerTask(ctx context.Context,
var needBackSource bool
if err != nil {
- logger.Errorf("step 1: peer %s register failed: err", request.PeerId, err)
+ if err == context.DeadlineExceeded {
+ logger.Errorf("scheduler did not response in %s", schedulerOption.ScheduleTimeout.Duration)
+ }
+ logger.Errorf("step 1: peer %s register failed: %s", request.PeerId, err)
if schedulerOption.DisableAutoBackSource {
logger.Errorf("register peer task failed: %s, peer id: %s, auto back source disabled", err, request.PeerId)
span.RecordError(err)
