Skip to content

Commit

Permalink
feat(scheduler): handle DownloadPieceFinishedRequest and DownloadPiec…
Browse files Browse the repository at this point in the history
…eFailedRequest asynchronously (#3847)

Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Feb 19, 2025
1 parent 832bd52 commit 6f58ed0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scheduler/service/service_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -1746,16 +1746,20 @@ func (v *V2) AnnouncePersistentCachePeer(stream schedulerv2.Scheduler_AnnouncePe
downloadPieceFinishedRequest := announcePersistentCachePeerRequest.DownloadPieceFinishedRequest

log.Info("receive DownloadPieceFinishedRequest")
if err := v.handleDownloadPersistentCachePieceFinishedRequest(ctx, req.GetPeerId(), downloadPieceFinishedRequest); err != nil {
log.Error(err)
}
go func() {
if err := v.handleDownloadPersistentCachePieceFinishedRequest(context.Background(), req.GetPeerId(), downloadPieceFinishedRequest); err != nil {
log.Error(err)
}
}()
case *schedulerv2.AnnouncePersistentCachePeerRequest_DownloadPieceFailedRequest:
downloadPieceFailedRequest := announcePersistentCachePeerRequest.DownloadPieceFailedRequest

log.Info("receive DownloadPieceFailedRequest")
if err := v.handleDownloadPersistentCachePieceFailedRequest(ctx, req.GetPeerId(), downloadPieceFailedRequest); err != nil {
log.Error(err)
}
go func() {
if err := v.handleDownloadPersistentCachePieceFailedRequest(context.Background(), req.GetPeerId(), downloadPieceFailedRequest); err != nil {
log.Error(err)
}
}()
default:
msg := fmt.Sprintf("receive unknow request: %#v", announcePersistentCachePeerRequest)
log.Error(msg)
Expand Down

0 comments on commit 6f58ed0

Please sign in to comment.