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

Improve telegram startup, fix master/sub issues #5537

Merged
merged 5 commits into from
Sep 19, 2016
Merged

Improve telegram startup, fix master/sub issues #5537

merged 5 commits into from
Sep 19, 2016

Conversation

Gobberwart
Copy link
Contributor

@Gobberwart Gobberwart commented Sep 18, 2016

Short Description:

At startup, telegram handler follows this pattern... Create bot instance -> Connect to Telegram API -> Split to new thread.

Connect might take several seconds, slowing bot startup while running in main thread.

Changed to Create bot instance -> Split to new thread -> Connect to Telegram API

For me, startup time reduced from 9 seconds to <3 consistently. YMMV.

In addition, there were some issues with bot correctly identifying and sending info to master unless explicitly set in config. Some refactoring and logic fixes made to correct this.

Fixes/Resolves/Closes (please use correct syntax):

Improved startup for me by several seconds.
@mention-bot
Copy link

@Gobberwart, thanks for your PR! By analyzing the annotation information on this pull request, we identified @DBa2016, @askovpen and @javajohnHub to be potential reviewers

@Gobberwart
Copy link
Contributor Author

Work in progress. @javajohnHub your thoughts?

Copy link
Contributor

@javajohnHub javajohnHub left a comment

Choose a reason for hiding this comment

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

In my opinion it is the correct working solution. VERY Noticable difference.

No point calling the telegram handler at all if no msg to send (should
be faster!)
@Gobberwart
Copy link
Contributor Author

Still work in progress due to issues with master. Working on it.

Events return sorted alphabetically. Just makes things easier to
read/find and tends to group like events together.
@Gobberwart
Copy link
Contributor Author

OK, this should be right for final testing/approval. I found a bug in the "master" identification logic, so have done some refactoring and logic fixing. Now works correctly with master in config or not (numeric or username), password authentication, multiple masters again.

This has been moved to chathandler, so not needed in telegramhandler.
All other imports required/in use.
@Gobberwart
Copy link
Contributor Author

Sorry, wasn't QUITE ready. Now it is and I'm not touching it again unless someone finds a bug.

@Gobberwart Gobberwart changed the title Improve telegram startup Improve telegram startup, fix master/sub issues Sep 19, 2016
@Gobberwart
Copy link
Contributor Author

Approval from @YvesHenri, merging.

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.

4 participants