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: optimize api for shceduling #3660

Merged
merged 1 commit into from
Nov 22, 2024
Merged
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module d7y.io/dragonfly/v2
go 1.23.0

require (
d7y.io/api/v2 v2.0.171
d7y.io/api/v2 v2.0.173
github.com/MysteriousPotato/go-lockable v1.0.0
github.com/RichardKnop/machinery v1.10.8
github.com/Showmax/go-fqdn v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
d7y.io/api/v2 v2.0.171 h1:iHMAhim/BFJ6MhZzsGMmVqF/h0Atw59g/0GuYFyhGxg=
d7y.io/api/v2 v2.0.171/go.mod h1:HLM5CjwBmy1pDGNUsUNkQeQPItblnHmeTJBEvBDbGnE=
d7y.io/api/v2 v2.0.173 h1:eSEAdrjINtQI8frgFYD4YBNE3XBlySzsDHxrq7QXMoA=
d7y.io/api/v2 v2.0.173/go.mod h1:HLM5CjwBmy1pDGNUsUNkQeQPItblnHmeTJBEvBDbGnE=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U=
Expand Down
2 changes: 1 addition & 1 deletion scheduler/resource/persistentcache/host_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@
}

// Set time fields from raw host.
announceInterval, err := strconv.ParseInt(rawHost["announce_interval"], 10, 32)
announceInterval, err := strconv.ParseUint(rawHost["announce_interval"], 10, 64)
if err != nil {
log.Errorf("parsing announce interval failed: %v", err)
return nil, false
Expand Down Expand Up @@ -452,7 +452,7 @@
network,
disk,
build,
time.Duration(announceInterval),

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
createdAt,
updatedAt,
logger.WithHost(rawHost["id"], rawHost["hostname"], rawHost["ip"]),
Expand Down
2 changes: 1 addition & 1 deletion scheduler/resource/persistentcache/peer_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
}

// Set time fields from raw task.
cost, err := strconv.ParseInt(rawPeer["cost"], 10, 32)
cost, err := strconv.ParseUint(rawPeer["cost"], 10, 64)
if err != nil {
log.Errorf("parsing cost failed: %v", err)
return nil, false
Expand Down Expand Up @@ -155,7 +155,7 @@
blockParents,
task,
host,
time.Duration(cost),

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
createdAt,
updatedAt,
logger.WithPeer(host.ID, task.ID, rawPeer["id"]),
Expand Down
2 changes: 1 addition & 1 deletion scheduler/resource/persistentcache/task_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}

// Set time fields from raw task.
ttl, err := strconv.ParseInt(rawTask["ttl"], 10, 32)
ttl, err := strconv.ParseUint(rawTask["ttl"], 10, 64)
if err != nil {
log.Errorf("parsing ttl failed: %v", err)
return nil, false
Expand Down Expand Up @@ -136,7 +136,7 @@
contentLength,
int32(totalPieceCount),
digest,
time.Duration(ttl),

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
createdAt,
updatedAt,
logger.WithTaskID(rawTask["id"]),
Expand Down
Loading