Skip to content

fix: ResourceId toString #1072

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

Merged
merged 2 commits into from
Mar 23, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void eventProcessingFinished(
if (!running) {
return;
}
ResourceID resourceID = executionScope.getCustomResourceID();
ResourceID resourceID = executionScope.getResourceID();
log.debug(
"Event processing finished. Scope: {}, PostExecutionControl: {}",
executionScope,
Expand All @@ -202,7 +202,7 @@ void eventProcessingFinished(
cleanupOnSuccessfulExecution(executionScope);
metrics.finishedReconciliation(resourceID);
if (eventMarker.deleteEventPresent(resourceID)) {
cleanupForDeletedEvent(executionScope.getCustomResourceID());
cleanupForDeletedEvent(executionScope.getResourceID());
} else {
postExecutionControl.getUpdatedCustomResource().ifPresent(
r -> eventSourceManager.getControllerResourceEventSource().handleRecentResourceUpdate(
Expand Down Expand Up @@ -244,7 +244,7 @@ TimerEventSource<R> retryEventSource() {
private void handleRetryOnException(
ExecutionScope<R> executionScope, Exception exception) {
RetryExecution execution = getOrInitRetryExecution(executionScope);
var customResourceID = executionScope.getCustomResourceID();
var customResourceID = executionScope.getResourceID();
boolean eventPresent = eventMarker.eventPresent(customResourceID);
eventMarker.markEventReceived(customResourceID);

Expand All @@ -271,16 +271,16 @@ private void cleanupOnSuccessfulExecution(ExecutionScope<R> executionScope) {
log.debug(
"Cleanup for successful execution for resource: {}", getName(executionScope.getResource()));
if (isRetryConfigured()) {
retryState.remove(executionScope.getCustomResourceID());
retryState.remove(executionScope.getResourceID());
}
retryEventSource().cancelOnceSchedule(executionScope.getCustomResourceID());
retryEventSource().cancelOnceSchedule(executionScope.getResourceID());
}

private RetryExecution getOrInitRetryExecution(ExecutionScope<R> executionScope) {
RetryExecution retryExecution = retryState.get(executionScope.getCustomResourceID());
RetryExecution retryExecution = retryState.get(executionScope.getResourceID());
if (retryExecution == null) {
retryExecution = retry.initExecution();
retryState.put(executionScope.getCustomResourceID(), retryExecution);
retryState.put(executionScope.getResourceID(), retryExecution);
}
return retryExecution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public R getResource() {
return resource;
}

public ResourceID getCustomResourceID() {
public ResourceID getResourceID() {
return ResourceID.fromResource(resource);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public int hashCode() {

@Override
public String toString() {
return "CustomResourceID{" +
return "ResourceID{" +
"name='" + name + '\'' +
", namespace='" + namespace + '\'' +
'}';
Expand Down