Skip to content

Commit 6467dca

Browse files
committed
review: unnest if
Signed-off-by: Dr. Jan-Philip Gehrcke <[email protected]>
1 parent 402d8a6 commit 6467dca

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

cmd/compute-domain-kubelet-plugin/cleanup.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,21 @@ func (m *CheckpointCleanupManager) unprepareIfStale(ctx context.Context, cpuid s
112112
}
113113

114114
claim, err := m.getClaimByName(ctx, cpclaim.Name, cpclaim.Namespace)
115+
if err != nil && errors.IsNotFound(err) {
116+
117+
klog.V(4).Infof(
118+
"Checkpointed RC cleanup: partially prepared claim '%s/%s:%s' is stale: not found in API server",
119+
cpclaim.Namespace,
120+
cpclaim.Name,
121+
cpuid)
122+
m.unprepare(ctx, cpuid, cpclaim)
123+
return
124+
}
125+
126+
// A transient error during API server lookup. No explicit retry required.
127+
// The next periodic cleanup invocation will implicitly retry.
115128
if err != nil {
116-
if errors.IsNotFound(err) {
117-
klog.V(4).Infof(
118-
"Checkpointed RC cleanup: partially prepared claim '%s/%s:%s' is stale: not found in API server",
119-
cpclaim.Namespace,
120-
cpclaim.Name,
121-
cpuid)
122-
m.unprepare(ctx, cpuid, cpclaim)
123-
} else {
124-
// A transient error during API server lookup. No explicit retry
125-
// required. The next periodic cleanup invocation will
126-
// implicitly retry.
127-
klog.Infof("Checkpointed RC cleanup: skip for checkpointed claim %s: getClaimByName failed (retry later): %s", cpuid, err)
128-
}
129+
klog.Infof("Checkpointed RC cleanup: skip for checkpointed claim %s: getClaimByName failed (retry later): %s", cpuid, err)
129130
return
130131
}
131132

0 commit comments

Comments
 (0)