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: load empty return false in persistentcache #3697

Merged
merged 1 commit into from
Dec 10, 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
4 changes: 4 additions & 0 deletions scheduler/resource/persistentcache/host_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func (h *hostManager) Load(ctx context.Context, hostID string) (*Host, bool) {
return nil, false
}

if len(rawHost) == 0 {
return nil, false
}

// Set integer fields from raw host.
port, err := strconv.ParseInt(rawHost["port"], 10, 32)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions scheduler/resource/persistentcache/peer_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ func (p *peerManager) Load(ctx context.Context, peerID string) (*Peer, bool) {
return nil, false
}

if len(rawPeer) == 0 {
return nil, false
}

persistent, err := strconv.ParseBool(rawPeer["persistent"])
if err != nil {
log.Errorf("parsing persistent failed: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions scheduler/resource/persistentcache/task_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func (t *taskManager) Load(ctx context.Context, taskID string) (*Task, bool) {
return nil, false
}

if len(rawTask) == 0 {
return nil, false
}

// Set integer fields from raw task.
persistentReplicaCount, err := strconv.ParseUint(rawTask["persistent_replica_count"], 10, 64)
if err != nil {
Expand Down
Loading