Skip to content
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

disable contribute and finalize when callback is filled #579

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Add ContributeAndFinalize to `ReplicateWorkflow`. (#574)
- Add check for ContributeAndFinalize in `ReplicatesService`. (#576)
- Add `running2Finalized2Completed` in `TaskUpdateManager`. (#577 #578)
- Disable `contributeAndFinalize` with CallBack. (#579)
### Bug Fixes
- Prevent race condition on replicate update. (#568)
### Quality
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/iexec/core/workflow/ReplicateWorkflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.iexec.commons.poco.notification.TaskNotificationType;
import com.iexec.commons.poco.task.TaskDescription;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -195,7 +196,8 @@ TaskNotificationType getNextActionWhenStatusAndCause(ReplicateStatus whenStatus,
log.error("TaskDescription is null with a COMPUTED status, this case shouldn't happen");
return PLEASE_ABORT;
}
if (taskDescription.isTeeTask()) {
// We must check CallBack is empty because there is an issue in poco (transaction is revert)
if (taskDescription.isTeeTask() && StringUtils.isEmpty(taskDescription.getCallback())) {
return PLEASE_CONTRIBUTE_AND_FINALIZE;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ void shouldGetNextActionOnComputedWithoutTaskDescriptionShouldBePleaseAbort(){
.isEqualTo(PLEASE_ABORT);
}

@Test
void shouldGetNextActionOnComputedWithTeeTaskAndCallBackShouldBePlease(){
assertThat(replicateWorkflow
.getNextAction(COMPUTED,
null,
TaskDescription.builder().isTeeTask(true).callback("callback").build()))
.isEqualTo(PLEASE_CONTRIBUTE);
}

// endregion

/*
Expand Down