Skip to content

Commit c1803ce

Browse files
committed
Merge branch 'main' of github.com:dragonflyoss/dragonfly into release-2.2
2 parents 9cda3c8 + f3484ee commit c1803ce

File tree

11 files changed

+121
-36
lines changed

11 files changed

+121
-36
lines changed

deploy/docker-compose/template/client.template.yaml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ download:
3030
# rateLimit is the default rate limit of the download speed in KiB/MiB/GiB per second, default is 10GiB/s.
3131
rateLimit: 10GiB
3232
# pieceTimeout is the timeout for downloading a piece from source.
33-
pieceTimeout: 30s
33+
pieceTimeout: 60s
3434
# concurrentPieceCount is the number of concurrent pieces to download.
3535
concurrentPieceCount: 10
3636

@@ -76,9 +76,36 @@ scheduler:
7676
# Announcer will provide the scheduler with peer information for scheduling,
7777
# peer information includes cpu, memory, etc.
7878
announceInterval: 10s
79-
# scheduleTimeout is the timeout for scheduling. If the scheduling timesout, dfdaemon will back-to-source
80-
# download if enableBackToSource is true, otherwise dfdaemon will return download failed.
81-
scheduleTimeout: 30s
79+
# schedule_timeout is timeout for the scheduler to respond to a scheduling request from dfdaemon, default is 3 hours.
80+
#
81+
# If the scheduler's response time for a scheduling decision exceeds this timeout,
82+
# dfdaemon will encounter a `TokioStreamElapsed(Elapsed(()))` error.
83+
#
84+
# Behavior upon timeout:
85+
# - If `enable_back_to_source` is `true`, dfdaemon will attempt to download directly
86+
# from the source.
87+
# - Otherwise (if `enable_back_to_source` is `false`), dfdaemon will report a download failure.
88+
#
89+
# **Important Considerations Regarding Timeout Triggers**:
90+
# This timeout isn't solely for the scheduler's direct response. It can also be triggered
91+
# if the overall duration of the client's interaction with the scheduler for a task
92+
# (e.g., client downloading initial pieces and reporting their status back to the scheduler)
93+
# exceeds `schedule_timeout`. During such client-side processing and reporting,
94+
# the scheduler might be awaiting these updates before sending its comprehensive
95+
# scheduling response, and this entire period is subject to the `schedule_timeout`.
96+
#
97+
# **Configuration Guidance**:
98+
# To prevent premature timeouts, `schedule_timeout` should be configured to a value
99+
# greater than the maximum expected time for the *entire scheduling interaction*.
100+
# This includes:
101+
# 1. The scheduler's own processing and response time.
102+
# 2. The time taken by the client to download any initial pieces and download all pieces finished,
103+
# as this communication is part of the scheduling phase.
104+
#
105+
# Setting this value too low can lead to `TokioStreamElapsed` errors even if the
106+
# network and scheduler are functioning correctly but the combined interaction time
107+
# is longer than the configured timeout.
108+
scheduleTimeout: 3h
82109
# maxScheduleCount is the max count of schedule.
83110
maxScheduleCount: 5
84111
# enableBackToSource indicates whether enable back-to-source download, when the scheduling failed.

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ require (
6060
github.com/mennanov/limiters v1.11.0
6161
github.com/mitchellh/mapstructure v1.5.0
6262
github.com/montanaflynn/stats v0.7.1
63-
github.com/onsi/ginkgo/v2 v2.22.2
64-
github.com/onsi/gomega v1.36.2
63+
github.com/onsi/ginkgo/v2 v2.23.4
64+
github.com/onsi/gomega v1.36.3
6565
github.com/opencontainers/image-spec v1.1.0
6666
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
6767
github.com/pkg/errors v0.9.1
@@ -89,7 +89,7 @@ require (
8989
go.uber.org/zap v1.27.0
9090
golang.org/x/crypto v0.37.0
9191
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
92-
golang.org/x/oauth2 v0.29.0
92+
golang.org/x/oauth2 v0.30.0
9393
golang.org/x/sync v0.13.0
9494
golang.org/x/sys v0.33.0
9595
golang.org/x/time v0.11.0
@@ -181,7 +181,7 @@ require (
181181
github.com/google/btree v1.0.1 // indirect
182182
github.com/google/go-cmp v0.7.0 // indirect
183183
github.com/google/go-querystring v1.1.0 // indirect
184-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
184+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
185185
github.com/google/renameio/v2 v2.0.0 // indirect
186186
github.com/google/s2a-go v0.1.9 // indirect
187187
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
@@ -285,12 +285,13 @@ require (
285285
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
286286
go.opentelemetry.io/otel/metric v1.35.0 // indirect
287287
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
288+
go.uber.org/automaxprocs v1.6.0 // indirect
288289
go.uber.org/multierr v1.11.0 // indirect
289290
golang.org/x/arch v0.16.0 // indirect
290291
golang.org/x/net v0.39.0 // indirect
291292
golang.org/x/term v0.31.0 // indirect
292293
golang.org/x/text v0.24.0 // indirect
293-
golang.org/x/tools v0.28.0 // indirect
294+
golang.org/x/tools v0.31.0 // indirect
294295
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
295296
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
296297
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e // indirect

go.sum

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
771771
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
772772
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
773773
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
774-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
775-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
774+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8=
775+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
776776
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
777777
github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg=
778778
github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4=
@@ -1226,8 +1226,8 @@ github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8Ay
12261226
github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo=
12271227
github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw=
12281228
github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo=
1229-
github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU=
1230-
github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk=
1229+
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
1230+
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
12311231
github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
12321232
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
12331233
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -1246,8 +1246,8 @@ github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ
12461246
github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg=
12471247
github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM=
12481248
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
1249-
github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8=
1250-
github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY=
1249+
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
1250+
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
12511251
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
12521252
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
12531253
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
@@ -1322,6 +1322,8 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg
13221322
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkBTKvR5gQLgA3e0hqjkY9u1wm+iOL45VN/qI=
13231323
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
13241324
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
1325+
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
1326+
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
13251327
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
13261328
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
13271329
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
@@ -1663,6 +1665,8 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
16631665
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
16641666
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
16651667
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
1668+
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
1669+
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
16661670
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
16671671
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
16681672
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
@@ -1768,8 +1772,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
17681772
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
17691773
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
17701774
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1771-
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
1772-
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
1775+
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
1776+
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
17731777
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
17741778
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
17751779
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1853,8 +1857,8 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ
18531857
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
18541858
golang.org/x/oauth2 v0.0.0-20210113205817-d3ed898aa8a3/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
18551859
golang.org/x/oauth2 v0.0.0-20210201163806-010130855d6c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
1856-
golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98=
1857-
golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
1860+
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
1861+
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
18581862
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
18591863
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
18601864
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -2126,8 +2130,8 @@ golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
21262130
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
21272131
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
21282132
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
2129-
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
2130-
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
2133+
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
2134+
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
21312135
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
21322136
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
21332137
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

internal/job/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type PreheatRequest struct {
3030
Application string `json:"application" validate:"omitempty"`
3131
Priority int32 `json:"priority" validate:"omitempty"`
3232
Scope string `json:"scope" validate:"omitempty"`
33+
Percentage *uint8 `json:"percentage" validate:"omitempty,gte=1,lte=100"`
3334
ConcurrentCount int64 `json:"concurrent_count" validate:"omitempty"`
3435
CertificateChain [][]byte `json:"certificate_chain" validate:"omitempty"`
3536
InsecureSkipVerify bool `json:"insecure_skip_verify" validate:"omitempty"`

manager/gc/audit.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const (
4242
AuditGCTaskID = "audit"
4343
)
4444

45+
// NewAuditGCTask returns a new audit GC task.
4546
func NewAuditGCTask(db *gorm.DB) pkggc.Task {
4647
return pkggc.Task{
4748
ID: AuditGCTaskID,

manager/handlers/bucket.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121

2222
"github.com/gin-gonic/gin"
2323

24-
// nolint
25-
_ "d7y.io/dragonfly/v2/manager/models"
2624
// nolint
2725
"d7y.io/dragonfly/v2/manager/types"
2826
// nolint
27+
_ "d7y.io/dragonfly/v2/manager/models"
28+
// nolint
2929
_ "d7y.io/dragonfly/v2/pkg/objectstorage"
3030
)
3131

manager/job/preheat.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func (p *preheat) CreatePreheat(ctx context.Context, schedulers []models.Schedul
144144
FilteredQueryParams: json.FilteredQueryParams,
145145
Headers: json.Headers,
146146
Scope: json.Scope,
147+
Percentage: json.Percentage,
147148
ConcurrentCount: json.ConcurrentCount,
148149
CertificateChain: p.certificateChain,
149150
InsecureSkipVerify: p.insecureSkipVerify,
@@ -370,6 +371,7 @@ func (p *preheat) parseLayers(manifests []distribution.Manifest, args types.Preh
370371
FilteredQueryParams: args.FilteredQueryParams,
371372
Headers: nethttp.HeaderToMap(header),
372373
Scope: args.Scope,
374+
Percentage: args.Percentage,
373375
ConcurrentCount: args.ConcurrentCount,
374376
CertificateChain: p.certificateChain,
375377
InsecureSkipVerify: p.insecureSkipVerify,

manager/middlewares/ratelimiter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/gin-gonic/gin/binding"
2626
)
2727

28+
// CreateJobRateLimiter create job rate limiter middleware
2829
func CreateJobRateLimiter(limiter ratelimiter.JobRateLimiter) gin.HandlerFunc {
2930
return func(c *gin.Context) {
3031
var json types.CreateJobRequest

manager/types/job.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ type PreheatArgs struct {
145145
// Scope is the scope for preheating, default is single_seed_peer.
146146
Scope string `json:"scope" binding:"omitempty"`
147147

148+
// Percentage is the percentage of the peer to be preheated.
149+
Percentage *uint8 `json:"percentage" binding:"omitempty,gte=1,lte=100"`
150+
148151
// BatchSize is the batch size for preheating all peers, default is 50.
149152
ConcurrentCount int64 `json:"concurrent_count" binding:"omitempty,gte=1,lte=500"`
150153

0 commit comments

Comments
 (0)