Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add load_to_cache field in preheat request using Open API #3838

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/job/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type PreheatRequest struct {
CertificateChain [][]byte `json:"certificate_chain" validate:"omitempty"`
InsecureSkipVerify bool `json:"insecure_skip_verify" validate:"omitempty"`
Timeout time.Duration `json:"timeout" validate:"omitempty"`
LoadToCache bool `json:"load_to_cache" validate:"omitempty"`
}

// PreheatResponse defines the response parameters for preheating.
Expand Down
1 change: 1 addition & 0 deletions manager/job/preheat.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (p *preheat) CreatePreheat(ctx context.Context, schedulers []models.Schedul
CertificateChain: p.certificateChain,
InsecureSkipVerify: p.insecureSkipVerify,
Timeout: json.Timeout,
LoadToCache: json.LoadToCache,
},
}
default:
Expand Down
3 changes: 3 additions & 0 deletions manager/types/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ type PreheatArgs struct {

// Timeout is the timeout for preheating, default is 30 minutes.
Timeout time.Duration `json:"timeout" binding:"omitempty"`

// LoadToCache is the flag for preheating content in cache storage.
LoadToCache bool `json:"load_to_cache" binding:"omitempty"`
}

type CreateSyncPeersJobRequest struct {
Expand Down
3 changes: 3 additions & 0 deletions scheduler/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ func (j *job) preheatAllSeedPeers(ctx context.Context, taskID string, req *inter
RequestHeader: req.Headers,
Timeout: durationpb.New(req.Timeout),
CertificateChain: req.CertificateChain,
LoadToCache: req.LoadToCache,
}})
if err != nil {
log.Errorf("preheat failed: %s", err.Error())
Expand Down Expand Up @@ -448,6 +449,7 @@ func (j *job) preheatAllPeers(ctx context.Context, taskID string, req *internalj
RequestHeader: req.Headers,
Timeout: durationpb.New(req.Timeout),
CertificateChain: req.CertificateChain,
LoadToCache: req.LoadToCache,
}})
if err != nil {
log.Errorf("preheat failed: %s", err.Error())
Expand Down Expand Up @@ -590,6 +592,7 @@ func (j *job) preheatV2(ctx context.Context, taskID string, req *internaljob.Pre
FilteredQueryParams: filteredQueryParams,
RequestHeader: req.Headers,
CertificateChain: req.CertificateChain,
LoadToCache: req.LoadToCache,
}})
if err != nil {
log.Errorf("preheat failed: %s", err.Error())
Expand Down
Loading