Skip to content

Commit cac67b8

Browse files
committed
feat: update
Signed-off-by: Gaius <gaius.qi@gmail.com>
1 parent 58045b8 commit cac67b8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

manager/job/preheat.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ func (p *preheat) CreatePreheat(ctx context.Context, schedulers []models.Schedul
124124
return nil, err
125125
}
126126
case PreheatFileType:
127-
// File preheat supports to preheat multiple files and single file.
128-
if json.URL == "" && len(json.URLs) == 0 {
127+
urls := json.URLs
128+
if json.URL != "" {
129+
urls = append(urls, json.URL)
130+
}
131+
132+
if len(urls) == 0 {
129133
return nil, errors.New("invalid params: url or urls is required")
130134
}
131135

@@ -135,7 +139,7 @@ func (p *preheat) CreatePreheat(ctx context.Context, schedulers []models.Schedul
135139
}
136140

137141
files = append(files, internaljob.PreheatRequest{
138-
URLs: append(json.URLs, json.URL),
142+
URLs: urls,
139143
PieceLength: json.PieceLength,
140144
Tag: json.Tag,
141145
Application: json.Application,

scheduler/job/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func (j *job) preheatV2SingleSeedPeer(ctx context.Context, req *internaljob.Preh
296296
eg, _ := errgroup.WithContext(ctx)
297297
eg.SetLimit(int(req.ConcurrentCount))
298298

299-
var preheatResp *internaljob.PreheatResponse
299+
preheatResp := &internaljob.PreheatResponse{}
300300
for _, url := range req.URLs {
301301
eg.Go(func() error {
302302
resp, err := j.preheatV2SingleSeedPeerByURL(ctx, url, req, log)

0 commit comments

Comments
 (0)