Skip to content

Commit

Permalink
EDP Log Levels Corrections (#764)
Browse files Browse the repository at this point in the history
* EDP Log Leves Corrections

* Corrected Error Placement

* Corrected Error Level

* Linter
  • Loading branch information
ralikio authored May 15, 2024
1 parent bfbaf9a commit c1936b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions internal/process/deprovisioning/deregister_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ func (s *DeregisterClusterStep) Run(operation internal.Operation, log logrus.Fie
}

func (s *DeregisterClusterStep) handleError(operation internal.Operation, err error, log logrus.FieldLogger, msg string) (internal.Operation, time.Duration, error) {
log.Errorf("%s: %s", msg, err)

if kebErrors.IsTemporaryError(err) {
since := time.Since(operation.UpdatedAt)
if since < 30*time.Minute {
log.Errorf("request to the Reconciler failed: %s. Retry...", err)
log.Warnf("request to the Reconciler failed: %s. Retry...", err)
return operation, 15 * time.Second, nil
}
}
Expand All @@ -66,5 +64,8 @@ func (s *DeregisterClusterStep) handleError(operation internal.Operation, err er
if repeat != 0 {
return operation, repeat, err
}

log.Errorf("%s: %s", msg, err)

return operation, 0, nil
}
7 changes: 4 additions & 3 deletions internal/process/deprovisioning/edp_deregistration.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,10 @@ func (s *EDPDeregistrationStep) Run(operation internal.Operation, log logrus.Fie
}

func (s *EDPDeregistrationStep) handleError(operation internal.Operation, err error, log logrus.FieldLogger, msg string) (internal.Operation, time.Duration, error) {
log.Errorf("%s: %s", msg, err)

if kebError.IsTemporaryError(err) {
since := time.Since(operation.UpdatedAt)
if since < time.Minute*30 {
log.Errorf("request to EDP failed: %s. Retry...", err)
log.Warnf("request to EDP failed: %s. Retry...", err)
return operation, 10 * time.Second, nil
}
}
Expand All @@ -112,5 +110,8 @@ func (s *EDPDeregistrationStep) handleError(operation internal.Operation, err er
if repeat != 0 {
return operation, repeat, err
}

log.Errorf("%s: %s", msg, err)

return operation, 0, nil
}

0 comments on commit c1936b1

Please sign in to comment.