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

Delay task logs #4724

Merged
merged 7 commits into from
Aug 26, 2016
Merged

Delay task logs #4724

merged 7 commits into from
Aug 26, 2016

Conversation

Gzerox
Copy link
Contributor

@Gzerox Gzerox commented Aug 25, 2016

Short Description:

I just wanted to find a way to put a delay between each "moving_to_fort" log.
The implementation is bit more generic to allow easily setup a delay for other worker too.

I know that this is not a needed stuff, and probably useless

But, hey ! I'm python beginner, just having fun :P

      {
        "type": "MoveToFort",
        "config": {
          "enabled": true,
          "lure_attraction": true,
          "lure_max_distance": 2000,
          "walker": "StepWalker",
          "log_delay": 5
        }
      }

Fixes/Resolves/Closes:

@mention-bot
Copy link

@Gzerox, thanks for your PR! By analyzing the annotation information on this pull request, we identified @douglascamata, @mjmadsen and @mhdasding to be potential reviewers

@Gzerox
Copy link
Contributor Author

Gzerox commented Aug 25, 2016

Ops, i forgot to write tests case. 😭

Please don't close !

@@ -169,7 +169,8 @@
"enabled": true,
"lure_attraction": true,
"lure_max_distance": 2000,
"walker": "StepWalker"
"walker": "StepWalker",
"log_delay": 5
Copy link
Contributor

@solderzzc solderzzc Aug 25, 2016

Choose a reason for hiding this comment

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

hmm, log_delay the wording lead me misunderstood. I was thinking the log will delay to show, that's not what you mean in code.
Any better wording suggestion since I'm not English natively speaking guy :)

Copy link
Contributor

Choose a reason for hiding this comment

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

log_interval maybe?

Copy link
Contributor

@k4n30 k4n30 Aug 26, 2016

Choose a reason for hiding this comment

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

or terminal_update_delay

@mjmadsen
Copy link
Contributor

Could you please update configuration_files.md as well?

@solderzzc
Copy link
Contributor

This branch has conflicts that must be resolved

web
@@ -1 +1 @@
Subproject commit 6ba5609c6151507b5b832a74e471b6b7b1a182c9
Subproject commit 607397a13f344c0fdc44bd9961332c1efe205de9
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this version of web working with current branch?

@solderzzc solderzzc merged commit 0c6d332 into PokemonGoF:dev Aug 26, 2016
@alexyaoyang
Copy link
Contributor

@Gzerox A small bug when recycling items:

Traceback (most recent call last):
  File "pokecli.py", line 746, in <module>
    main()
  File "pokecli.py", line 126, in main
    bot.tick()
  File "/Users/alex/Documents/PoGoMap/PokemonGo-Bot/pokemongo_bot/__init__.py", line 640, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/Users/alex/Documents/PoGoMap/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items.py", line 189, in work
    if ItemRecycler(self.bot, item_in_inventory, self.get_amount_to_recycle(item_in_inventory)).work() == WorkerResult.ERROR:
  File "/Users/alex/Documents/PoGoMap/PokemonGo-Bot/pokemongo_bot/services/item_recycle_worker.py", line 39, in work
    self._emit_recycle_succeed()
  File "/Users/alex/Documents/PoGoMap/PokemonGo-Bot/pokemongo_bot/services/item_recycle_worker.py", line 94, in _emit_recycle_succeed
    'item': self.item_to_recycle.name,
  File "/Users/alex/Documents/PoGoMap/PokemonGo-Bot/pokemongo_bot/base_task.py", line 35, in emit_event
    if (time.time() - self.last_log_time) > self.config.get('log_interval', 0):
AttributeError: 'ItemRecycler' object has no attribute 'last_log_time'

@Gzerox
Copy link
Contributor Author

Gzerox commented Aug 27, 2016

I'm traveling right now, bit the follow addition should fix the problem:

File: services/item_recycle_worker.py method init:

self.last_log_time = time.time()

Thanks!

This was referenced Aug 27, 2016
@mjmadsen
Copy link
Contributor

Added that change in a PR @Gzerox Thanks!

solderzzc added a commit that referenced this pull request Aug 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants