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

[CCI] BaseConnectionPool missing implementation of markAlive and markDead methods #449

Closed
wants to merge 8 commits into from

Conversation

timursaurus
Copy link
Collaborator

@timursaurus timursaurus commented Mar 22, 2023

Description

Implement BaseConnectionPool markDead and markAlive methods
Fix unit test

Issues Resolved

Closes #429

Check List

  • New functionality includes testing.
    • All tests pass
  • Linter check was successfull - yarn run lint doesn't show any errors
  • Commits are signed per the DCO using --signoff
  • Changelog was updated.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Timur Bolotov <[email protected]>
Signed-off-by: Timur Bolotov <[email protected]>
Signed-off-by: Timur Bolotov <[email protected]>
Signed-off-by: Timur Bolotov <[email protected]>
@timursaurus timursaurus changed the title BaseConnectionPool missing implementation of markAlive and markDead methods [CCI] BaseConnectionPool missing implementation of markAlive and markDead methods Mar 22, 2023
@nhtruong nhtruong added the CCI College Contributor Initiative label Mar 22, 2023
t.end();
});

t.test('call markDead twice', (t) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you have to call markDead twice? Calling it once won't work?

Copy link
Collaborator Author

@timursaurus timursaurus Mar 22, 2023

Choose a reason for hiding this comment

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

Why do you have to call markDead twice? Calling it once won't work?

#430 (review)
Calling it once does work, but I wanted to implement what @dblock suggested. I'm still not sure of it

@@ -249,4 +249,28 @@ console.log('Deleting all PITs:');
var response = await client.deleteAllPits();

console.log(response.body);
```

## Mark connection as `dead`
Copy link
Member

Choose a reason for hiding this comment

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

I'd explain what the purpose of this call is, and ensure it fails when called twice.

Copy link
Collaborator Author

@timursaurus timursaurus Mar 23, 2023

Choose a reason for hiding this comment

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

By fail you mean a runtime error should be thrown when markDead is called on the same connection twice?

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 so. Unless there's a reason not to.

I still don't quite get how and when this API is used?

Copy link
Collaborator

Choose a reason for hiding this comment

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

These methods are probably syntactical sugar for set status method (There only 2 valid connection Statuses: DEAD or ALIVE). I still don't understand why it must throw an error when you set status to DEAD twice though. Wouldn't that also introduce new business logic that will cause trouble for users who are marking a connection as DEAD again?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also since we have set status in Connection class, it makes more sense to move markDead and markAlive from ConnectionPool into Connection since you can change the status of the connection directly anyway. That is instead of client.connectionPool.markAlive(connection), we will do connection.markAlive(). A lot more convenient and less confusing because it has nothing to do with ConnectionPool.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds like an RFC to me
Should we implement this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should move it to Connection for the reason mentioned above

@nhtruong
Copy link
Collaborator

@timursaurus do you wanna rebase this one so we can get it merged? Thank you :)

Signed-off-by: Timur Bolotov <[email protected]>
Signed-off-by: Timur Bolotov <[email protected]>
Signed-off-by: Timur Bolotov <[email protected]>
@nhtruong
Copy link
Collaborator

nhtruong commented Mar 4, 2024

Too stale

@nhtruong nhtruong closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCI College Contributor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] [CCI] BaseConnectionPool empty methods
3 participants