Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuqi-lucas committed Sep 27, 2024
1 parent 5ea3ac0 commit 8b843cc
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions pkg/cache/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,18 +641,16 @@ func (app *Application) handleReleaseAppAllocationEvent(taskID string, terminati
// Get the pod first to check if it exists
// For example, users manually killed the pod, so the pod already deleted before release.
_, err := task.context.apiProvider.GetAPIs().KubeClient.Get(pod.Namespace, pod.Name)
if err != nil {
if k8serrors.IsNotFound(err) {
// Pod does not exist, no need to delete
log.Log(log.ShimCacheApplication).Info("pod not found, it already deleted or released")
} else {
log.Log(log.ShimCacheApplication).Error("failed to get pod", zap.Error(err))
if err != nil && k8serrors.IsNotFound(err) {
// Pod does not exist, no need to delete
log.Log(log.ShimCacheApplication).Info("pod not found, it already deleted or released")

Check warning on line 646 in pkg/cache/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/cache/application.go#L646

Added line #L646 was not covered by tests
} else {
// Pod exists, delete it
err = task.DeleteTaskPod()
if err != nil {
log.Log(log.ShimCacheApplication).Error("failed to release allocation from application", zap.Error(err))

Check warning on line 651 in pkg/cache/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/cache/application.go#L651

Added line #L651 was not covered by tests
}
}
err = task.DeleteTaskPod()
if err != nil {
log.Log(log.ShimCacheApplication).Error("failed to release allocation from application", zap.Error(err))
}
app.publishPlaceholderTimeoutEvents(task)
} else {
log.Log(log.ShimCacheApplication).Warn("task not found",
Expand Down

0 comments on commit 8b843cc

Please sign in to comment.