Skip to content

Conversation

@james-toussaint
Copy link
Contributor

No description provided.

@james-toussaint james-toussaint requested a review from zguesmi May 31, 2019 12:43

ContributionAuthorization contributionAuth = interruptedReplicate.getContributionAuthorization();
RecoveryAction recoveryAction = interruptedReplicate.getRecoveryAction();
ContributionAuthorization contributionAuth = missedTaskNotification.getTaskNotificationExtra().getContributionAuthorization();
Copy link
Member

Choose a reason for hiding this comment

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

The contributionAuth is not going to be there every time, instead, we can get the chainTaskId from the taskNotification itself.

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!


if (!oReplicateModel.isPresent()) {
if (!optionalTaskDescription.isPresent()) {
log.error("Could not recover task, no replicateModel retrieved [chainTaskId:{}, RecoveryAction:{}]",
Copy link
Member

Choose a reason for hiding this comment

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

maybe replace "replicateModel" with "task description" for consistency sake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


@PostConstruct
public void initIt() {
corePublicAddress = customFeignClient.getPublicConfiguration().getSchedulerPublicAddress();
Copy link
Member

Choose a reason for hiding this comment

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

We can use "publicConfigurationService.getSchedulerPublicAddress()" instead of sending another HTTP request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Async
private String compute(AvailableReplicateModel replicateModel) {
ContributionAuthorization contributionAuth = replicateModel.getContributionAuthorization();
private String compute(ContributionAuthorization contributionAuth) {
Copy link
Member

Choose a reason for hiding this comment

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

If the goal is to use "contributionAuth" only in the contribute() logic we should pass the TaskDescription instead. That would also remove the repeated call "getTaskDescriptionFromChain(chainTaskId)".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that was the initial plan, but in a future PR :)

}


public void tryToContribute(ContributionAuthorization contributionAuth) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to replace this method by an "isReadyToContribute()" method and use it in the subscriptionService so the latter stays the entrypoint that explicitly creates replicates (even when recovering)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we are going to tune that in a second time

@james-toussaint james-toussaint requested a review from zguesmi June 3, 2019 14:14
@james-toussaint james-toussaint merged commit 1f9a123 into master Jun 3, 2019
@james-toussaint james-toussaint deleted the notification-type-for-recovery branch June 3, 2019 14:40
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