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

Check if Worker can still accept more work right before giving it a new replicate #644

Merged
merged 8 commits into from
Dec 14, 2023

Conversation

mcornaton
Copy link
Contributor

@mcornaton mcornaton commented Dec 13, 2023

No description provided.

@mcornaton mcornaton marked this pull request as ready for review December 13, 2023 14:45
@mcornaton mcornaton changed the title Check if Worker can still accept more work right before giving it new… Check if Worker can still accept more work right before giving it a new replicate Dec 13, 2023
@@ -104,11 +99,16 @@ Optional<ReplicateTaskSummary> getAvailableReplicateTaskSummary(long workerLastB

// TODO : Remove this, the optional can never be empty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO can be removed. It was relevant before the optimization.
Now worker becomes an argument from canAcceptMoreWorks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Please see d0c0db7.

CHANGELOG.md Outdated
@@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [[8.2.3]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.2.3) 2023-12-13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## [[8.2.3]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.2.3) 2023-12-13
## [[8.2.3]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.2.3) 2023-12-14

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder. Please see caff7a7.

Comment on lines 196 to 204
final Optional<ReplicatesList> oReplicatesList = replicatesService.getReplicatesList(chainTaskId);
// Check is only here to prevent
// "`Optional.get()` without `isPresent()` warning".
// This case should not happen.
if (oReplicatesList.isEmpty()) {
return false;
}

final ReplicatesList replicatesList = oReplicatesList.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this more condensed form to avoid unnecessary final Optional ?

Suggested change
final Optional<ReplicatesList> oReplicatesList = replicatesService.getReplicatesList(chainTaskId);
// Check is only here to prevent
// "`Optional.get()` without `isPresent()` warning".
// This case should not happen.
if (oReplicatesList.isEmpty()) {
return false;
}
final ReplicatesList replicatesList = oReplicatesList.get();
final ReplicatesList replicatesList = replicatesService.getReplicatesList(chainTaskId).orElse(null);
if (replicatesList == null) {
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can totally be done at a later time or not at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right we can do something better. I've tried the functional way. Let me know if it suits you :)
5ddcf26

Copy link

@mcornaton mcornaton merged commit 1093c4a into main Dec 14, 2023
2 checks passed
@mcornaton mcornaton deleted the hotfix/8.2.3 branch December 14, 2023 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants