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

Rename checkConnection #20

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Conversation

erikbosch
Copy link
Contributor

The previous method name could give the impression that the connection actually would be checked when the method was called.

What the method actually does it just to report the flag that is set when the initial connection has been established and the client is ready to receive data from the broker/server. That should hopefully be more clear after the change of name.

Old name kept on "top level" to not introduce any backward incompatible changes.

Fixes eclipse/kuksa.val#523

@@ -559,10 +559,15 @@ def do_disconnect(self, _args):
self.commThread.stop()
self.commThread = None

def checkConnection(self):
if self.commThread is None or not self.commThread.checkConnection():
def connection_established(self) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we name this different. I see that we had aslo two checkConnection functions but I kind of find it confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have a better suggestion on method name?

If we look at actual behavior the implementation (for both ws and grpc) that a variable is set to true when we succeed with the initial connection, then it remains true until we request the connection to be closed. If ther server/broker goes down does not affect what the method return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, had another look now and I don't know why I found it confusing back then :) so think its fine

Copy link
Contributor

@lukasmittag lukasmittag left a comment

Choose a reason for hiding this comment

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

else LGTM

@@ -559,10 +559,15 @@ def do_disconnect(self, _args):
self.commThread.stop()
self.commThread = None

def checkConnection(self):
if self.commThread is None or not self.commThread.checkConnection():
def connection_established(self) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, had another look now and I don't know why I found it confusing back then :) so think its fine

The previous method name could give the impression that the connection
actually would be checked when the method was called.

What the method actually does it just to report the flag that is set when the
initial connection has been established and the client is ready to receive data
from the broker/server. That should hopefully be more clear after the change of name.

Old name kept on "top level" to not introduce any backward incompatible changes.

Fixes eclipse/kuksa.val#523
Copy link
Contributor

@lukasmittag lukasmittag left a comment

Choose a reason for hiding this comment

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

looks good after rebase

@erikbosch erikbosch merged commit 30832b9 into eclipse-kuksa:main Mar 11, 2024
7 checks passed
@erikbosch erikbosch deleted the erik_check branch March 11, 2024 10:10
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.

Kuksa-client method checkConnection does not work as I expect it
2 participants