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

Useless check or Waste of time #378

Open
knkitten opened this issue Nov 22, 2021 · 3 comments
Open

Useless check or Waste of time #378

knkitten opened this issue Nov 22, 2021 · 3 comments

Comments

@knkitten
Copy link

In file

def login(self, username, password='', login_key=None, auth_code=None, two_factor_code=None, login_id=None):

in method called login on line 569 we can see a useless check:

if resp and resp.body.eresult == EResult.OK:
    self.sleep(0.5)

this is useless because it is followed by a return string of this method:

return EResult(resp.body.eresult) if resp else EResult.Fail

And why we spend exactly 0.5 seconds, why, for example, not 0.25 or even 1 second?

@rossengeorgiev
Copy link
Member

That is hack to allow a couple of async events to run before the functions returns. Could potentially be improved

@knkitten
Copy link
Author

@rossengeorgiev Can you give an example of when this hack starts to work? My primitive tests show that this line can be safely removed.

@rossengeorgiev
Copy link
Member

According to the origin commit 9ef8e5d it is to allow the client to be considered fully connected (on the backend i guess). I was getting disconnected when I tried to send message immediately after login() returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants