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

Slow bot startup after telegram is enabled #5527

Closed
gengstah opened this issue Sep 18, 2016 · 11 comments
Closed

Slow bot startup after telegram is enabled #5527

gengstah opened this issue Sep 18, 2016 · 11 comments

Comments

@gengstah
Copy link
Contributor

Expected Behavior

The bot used to start fast.

Actual Behavior

After I enabled telegram, the bot startup is super slow.

Your FULL config.json (remove your username, password, gmapkey and any other private info)

config

Output when issue occurred

Please note the time differences of each log line. Mostly ten seconds or more. Before enabling telegram, I had no problem with this. The bot just starts fine and fast.
logs

Steps to Reproduce

Just run the bot. I specifically run the bot with these features enabled:

  • Social
  • FollowPath
  • MoveToMap
  • PokemonOptimizer
  • Telegram

Other Information

OS: Kali Linux (Debian Jessie)

Branch: dev

Git Commit: 1963971

Python Version: Python 2.7.9

Any other relevant files/configs (eg: path files)

Path Config

@gengstah
Copy link
Contributor Author

This slowdown might be caused by slow internet connection. I take that the TelegramTask sends one message at a time, no? So for each log message, the bot sends an api request to telegram and if internet connection is sluggish, then the bot is also sluggish. Can someone confirm this? Maybe we can have an option to batch send logs to minimize bandwidth consumption.

@javajohnHub
Copy link
Contributor

I think there are more events that can be removed from the list. I'll check it out today.

@javajohnHub
Copy link
Contributor

This should fix it I think... I got rid of all login events in telegram so it should only start sending msgs after the bot starts. Avoiding any bog at startup.

@javajohnHub
Copy link
Contributor

Sorry @Gobberwart wants to display events that dont fire in telegram instead of accepting this fix.

@Gobberwart
Copy link
Contributor

Not quite. I said I don't think removing events will fix slow startup, but I agreed with removing imports. I never said to close the PR, just maybe put a bit more thought/testing into it.

Also.. what do you mean "don't fire in telegram"? Why don't they fire? And how do they display if they don't fire?

@Gobberwart
Copy link
Contributor

Also worth noting that the section where you're removing events doesn't even run until the bot goes to generate a list of available events (in response to /events), and takes microseconds to run. All you're doing is hiding events from the available list. Should have zero impact on performance.

@javajohnHub
Copy link
Contributor

That just removes them from list. If you actually looked at the code you would see where i remove the actual subscription.

@javajohnHub
Copy link
Contributor

Its fine...i am wrong.

@Gobberwart
Copy link
Contributor

FYI I'm running Telegram with /sub all and this is what I get at start:

[2016-09-19 08:18:02] [PokemonGoBot] [INFO] Setting start location.
------alll the startup messages------
[2016-09-19 08:18:11] [PokemonGoBot] [INFO] Starting bot...
[2016-09-19 08:18:11] [IncubateEggs] [INFO] Eggs incubating: [3.65/5.0 km] (Eggs left: 8, Incubating: 1)

Since IncubateEggs is a task, that's complete startup in 9 seconds. With telegram running. I wouldn't call that slow.

@Gobberwart
Copy link
Contributor

OK just finished doing a fair bit of work on telegram handler which should a) improve speed and b) fix some issues with master. Waiting on merge approval now.

@Gobberwart
Copy link
Contributor

Fixed #5537

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

No branches or pull requests

3 participants