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

Change where a connection is deleted #19096

Merged
merged 10 commits into from
Nov 9, 2022
Merged

Conversation

benmoriceau
Copy link
Contributor

What

In ordert to fix a flaky test, we need to delete a connection as soon as the endpoint for the deletion is called.
This PR is moving the deletion from a temporal activity to the API call.

This is addressing #18266

Another PR is needed in order to remove the extra signal in case there is a version issue. Since this is a tail activity call, it can be done right after this PR is moved to cloud.

@github-actions github-actions bot added area/platform issues related to the platform area/server area/worker Related to worker labels Nov 7, 2022
Comment on lines +220 to +224
.toList();

for (final UUID uuidToDelete : uuidsToDelete) {
connectionsHandler.deleteConnection(uuidToDelete);
}
Copy link
Member

Choose a reason for hiding this comment

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

You could instead call .forEach instead of calling toList and then iterating over that list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is done on purpose in order to have the exception thrown by deleteConnection be thrown by the method (deleteConnection starts throwing in this PR).

Comment on lines 188 to 189
if (dontDeleteInTemporal < DONT_DELETE_IN_TEMPORAL_TAG_CURRENT_VERSION) {
if (workflowState.isDeleted()) {
Copy link
Member

Choose a reason for hiding this comment

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

Can combine these two if statements into one one to avoid one layer of nesting.

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

@benmoriceau benmoriceau temporarily deployed to more-secrets November 7, 2022 22:36 Inactive
@benmoriceau benmoriceau marked this pull request as draft November 8, 2022 01:53
@benmoriceau benmoriceau temporarily deployed to more-secrets November 8, 2022 01:55 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 8, 2022 01:58 Inactive
final int dontDeleteInTemporal =
Workflow.getVersion(DONT_DELETE_IN_TEMPORAL_TAG, Workflow.DEFAULT_VERSION, DONT_DELETE_IN_TEMPORAL_TAG_CURRENT_VERSION);

if (dontDeleteInTemporal < DONT_DELETE_IN_TEMPORAL_TAG_CURRENT_VERSION && workflowState.isDeleted()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not placed in the right place, if should be on like 195. I moved the PR back to a draft.

@benmoriceau benmoriceau temporarily deployed to more-secrets November 8, 2022 22:04 Inactive
@benmoriceau
Copy link
Contributor Author

The build is actually successful, it just fail to report its status.

@benmoriceau benmoriceau marked this pull request as ready for review November 8, 2022 23:13
client.newWorkflowStub(ConnectionManagerWorkflow.class, getConnectionManagerName(connectionId));
connectionManagerWorkflow.deleteConnection();
} catch (final Exception e) {
log.warn("The workflow is not reachable when trying to cancel it");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we log the exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opps, I forget that. Will update.

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

@benmoriceau benmoriceau temporarily deployed to more-secrets November 9, 2022 19:25 Inactive
@benmoriceau benmoriceau merged commit b3db914 into master Nov 9, 2022
@benmoriceau benmoriceau deleted the bmoric/update-delete-endpoint branch November 9, 2022 21:05
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
* Tmp

* Move when the deletion is performed

* Re-enable disable test

* PR comments

* Use cancel

* rename

* Fix test and version check position

* Log exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/server area/worker Related to worker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants