-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
Improved startup for me by several seconds.
@Gobberwart, thanks for your PR! By analyzing the annotation information on this pull request, we identified @DBa2016, @askovpen and @javajohnHub to be potential reviewers |
Work in progress. @javajohnHub your thoughts? |
There was a problem hiding this 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!)
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.
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.
Sorry, wasn't QUITE ready. Now it is and I'm not touching it again unless someone finds a bug. |
Approval from @YvesHenri, merging. |
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):