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

feat:(restart-inbound-connectors): create a restart inbound mechanism after cancelling #3505

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mathias-vandaele
Copy link
Contributor

Description

Second try for implementing the restart mechanism, I have tested it and it seems to be working
image

Related issues

closes #

Checklist

  • PR has a milestone or the no milestone label.

@mathias-vandaele mathias-vandaele requested a review from a team as a code owner October 16, 2024 15:16
Comment on lines 107 to 109
executables.remove(uuid);
executables.put(
uuid, new RegisteredExecutable.Cancelled(activated.executable(), activated.context()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use Map.replace() to switch the entry?

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CancellationManager {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide some documentation what the ConcellationManager is responsible for?

Comment on lines 80 to 82
executables.remove(uuid);
executables.put(
uuid, new RegisteredExecutable.Activated(cancelled.executable(), cancelled.context()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use Map.replace() to switch the entry?


private void tryRestart(
UUID uuid, RegisteredExecutable toReactivate, Duration delay, Integer retryAttempts) {
if (retryAttempts < 0) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the specification here? We stop restart if the the attempts are for example -1? Its not clear when this would happen

Copy link
Contributor Author

@mathias-vandaele mathias-vandaele Oct 17, 2024

Choose a reason for hiding this comment

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

Here depends of what we want to do:

  • In this case, retryAttempts means that if the user has set 3 retries, It means it will initially try then retry 3 times
  • In the other case, if the user has set 3 retries, it will try initially and then try again 2 times

What would a developer expect ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure but retryAttempts sounds like the number of attempts that already happened. I would prefer a sealed interface with first of two options: Just a restart and one with a delay.
Lets tackle the number of retries later.

Comment on lines 291 to 297
case Cancelled cancelled ->
new ActiveExecutableResponse(
id,
cancelled.executable().getClass(),
cancelled.context().connectorElements(),
cancelled.context().getHealth(),
cancelled.context().getLogs());
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we report the exception somewhere that cause the cancellation? Would be enough if its part of the health object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true 👍

@sbuettner
Copy link
Contributor

LGTM, some minor comments and please add some tests for the different paths.

@mathias-vandaele mathias-vandaele linked an issue Oct 18, 2024 that may be closed by this pull request
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.

Support inbound Connector restarts
2 participants