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

[Feature Request] Optional non-interupt for live_config_update #5075

Closed
RedViper9 opened this issue Sep 2, 2016 · 2 comments
Closed

[Feature Request] Optional non-interupt for live_config_update #5075

RedViper9 opened this issue Sep 2, 2016 · 2 comments

Comments

@RedViper9
Copy link
Contributor

RedViper9 commented Sep 2, 2016

Current Behavior

live_config_update restarts the bot immediately on config change.

Proposed Behavior

Options for live_config_update to not interrupt pokemon_catch_worker or pokemon_optimizer.
Optional since some might want to interrupt the optimizer if they catch it doing something unwanted.

Alternative Proposal

Store the currently running task and continue from that task on restart.
This seems more difficult for me and would still interrupt a catch, but restarting the optimizer is definitely desirable.

Potential Code

To get the first proposed behavior, in pokecli.py I added...

from pokemongo_bot.worker_result import WorkerResult

and changed line 155 to...

if config.live_config_update_enabled and config_changed() and worker.work() != WorkerResult.RUNNING:

but this gives

  File "pokecli.py", line 796, in <module>
    main()
  File "pokecli.py", line 155, in main
    if config.live_config_update_enabled and config_changed() and worker.work() != WorkerResult.RUNNING:
NameError: global name 'worker' is not defined

and certainly doesn't give you any options.

@RedViper9 RedViper9 changed the title [Feature Request] Optional non-interupt for live_confgi_update [Feature Request] Optional non-interupt for live_config_update Sep 2, 2016
@alexyaoyang
Copy link
Contributor

alexyaoyang commented Sep 2, 2016

Actually it should finish catching the pokemon before restarting the bot due to config change, because the part which checks for config change is after the tick() method. I've tried it numerous times on my mac.

Can you try this:

  1. Modify your config, but don't save
  2. Have your terminal at the side, watching for pokemon encounter
  3. Once you encounter a pokemon, save the config

See that it should continue to catch the pokemon before restarting the bot.

@RedViper9
Copy link
Contributor Author

This makes sense and you are quite right. The config update does not interrupt a catch.
I must have assumed that it does since I saw it interrupt the optimizer, but since that's likely the preferred behavior, no change needed.

Thanks.

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