feat: use context.Background for ScheduleCandidateParents to prevent stream breaking (#3485)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2024-09-06 11:18:37 +08:00 committed by GitHub
parent c463f7f63f
commit f1dec253fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

@ -1 +1 @@
Subproject commit 2fe844ac26afadbdee1b35f3fb7cd8e091929385 Subproject commit 232ee8ab4631f6781ee39ff36580db0426a2c801

View File

@ -963,7 +963,7 @@ func (v *V2) handleRegisterPeerRequest(ctx context.Context, stream schedulerv2.S
// Record the start time. // Record the start time.
start := time.Now() start := time.Now()
if err := v.scheduling.ScheduleCandidateParents(ctx, peer, peer.BlockParents); err != nil { if err := v.scheduling.ScheduleCandidateParents(context.Background(), peer, peer.BlockParents); err != nil {
// Collect RegisterPeerFailureCount metrics. // Collect RegisterPeerFailureCount metrics.
metrics.RegisterPeerFailureCount.WithLabelValues(priority.String(), peer.Task.Type.String(), metrics.RegisterPeerFailureCount.WithLabelValues(priority.String(), peer.Task.Type.String(),
peer.Host.Type.Name()).Inc() peer.Host.Type.Name()).Inc()
@ -1042,7 +1042,7 @@ func (v *V2) handleRescheduleRequest(ctx context.Context, peerID string, candida
// Record the start time. // Record the start time.
start := time.Now() start := time.Now()
if err := v.scheduling.ScheduleCandidateParents(ctx, peer, peer.BlockParents); err != nil { if err := v.scheduling.ScheduleCandidateParents(context.Background(), peer, peer.BlockParents); err != nil {
return status.Error(codes.FailedPrecondition, err.Error()) return status.Error(codes.FailedPrecondition, err.Error())
} }