Skip to content
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 pkg/picod/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (am *AuthManager) LoadPublicKeyFromEnv() error {

pub, err := x509.ParsePKIXPublicKey(block.Bytes)
if err != nil {
return fmt.Errorf("failed to parse public key: %v", err)
return fmt.Errorf("failed to parse public key: %w", err)
}

rsaPub, ok := pub.(*rsa.PublicKey)
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/store_valkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (vs *valkeyStore) loadSandboxesBySessionIDs(ctx context.Context, sessionIDs
// MGet should in same slot
stingSliceResults, err := vs.cli.Do(ctx, vs.cli.B().Mget().Key(sessionIDKeys...).Build()).AsStrSlice()
if err != nil {
return nil, fmt.Errorf("loadSandboxesBySessionIDs: Valkey MGet sandboxes failed: %v", err)
return nil, fmt.Errorf("loadSandboxesBySessionIDs: Valkey MGet sandboxes failed: %w", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While wrapping the error with %w is correct, there is a potential logic inconsistency in the surrounding code. The AsStrSlice() call on line 114 will return an error if any of the requested keys do not exist in Valkey (as MGET returns nil for missing keys, which AsStrSlice cannot convert to a string). This seems to conflict with the logic on lines 125-128, which attempts to skip missing entries. If missing keys are expected, consider using AsSlice() to handle individual elements. Additionally, note the typo in the variable name stingSliceResults on line 114.

}

if len(stingSliceResults) > len(sessionIDKeys) {
Expand Down
Loading