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

pokecli.py: wait_time for every exception randomized #5704

Merged
merged 2 commits into from
Nov 9, 2016

Conversation

mudmud2k
Copy link
Contributor

Feature Request (#5579)

Short Description:
it's create a random waiting time based on config for all exception (connection lost, throttling, and so on), so no static time span will be used anymore


randint(min,max)
config.reconnecting -> min
config.reconnection * 60 -> max

randint(min,max)
config.reconnecting -> min
config.reconnection * 60 -> max
@mention-bot
Copy link

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

@solderzzc
Copy link
Contributor

solderzzc commented Sep 27, 2016

👍

Approved with PullApprove

@YvesHenri
Copy link

Can't review now. Someone please do it and merge, if agreed.

@@ -185,7 +186,7 @@ def get_commit_hash():
finished = False

while not finished:
wait_time = config.reconnecting_timeout * 60
wait_time = randint(config.reconnecting_timeout, (config.reconnecting_timeout * 60))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs adjustment and docs changes: previously, config.reconnecting_timeout was "time in minutes". Now the wait_time spans from this valud to the 60-times of it.

Maybe randint(config.reconnecting_timeout*60, (config.reconnecting_timeout + 1) * 60)) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

an other possibility is to extend the config file with min and max entries, which I think is a overkill for that.

maybe only an random variation of the given time, something like 'randint((config.reconnecting_timeout * 0.8 * 60, config.reconnecting_timeout * 1.2 * 60))'
40% vast/span/range...

also, I don't find any documentation about it, but I thought that I saw an entry once.

)
time.sleep(30)
time.sleep(wait_time)
# sys.exit()
Copy link
Contributor

Choose a reason for hiding this comment

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

should be removed

@BreezeRo
Copy link
Contributor

Any updates on this?

@mudmud2k
Copy link
Contributor Author

mudmud2k commented Oct 12, 2016

still waiting for a review, or further discussion...

but without a working api, there is no need for it..

@solderzzc solderzzc dismissed DBa2016’s stale review November 9, 2016 01:36

Changed as requesting

@solderzzc
Copy link
Contributor

solderzzc commented Nov 9, 2016

👍

Approved with PullApprove

@solderzzc solderzzc merged commit e4b73f8 into PokemonGoF:dev Nov 9, 2016
@mudmud2k mudmud2k deleted the pokecli-wait_time branch November 9, 2016 18:56
@Gobberwart
Copy link
Contributor

This doesn't work as expected...

wait_time = randint((config.reconnecting_timeout * 0.8 * 60), (config.reconnecting_timeout * 1.2 * 60))

randint requires two INTEGER values, whereas this line provides two FLOATS. Result:

Traceback (most recent call last):
  File ".\pokecli.py", line 844, in <module>
    main()
  File ".\pokecli.py", line 189, in main
    wait_time = randint((config.reconnecting_timeout * 0.8 * 60), (config.reconnecting_timeout *  1.2 * 60))
  File "C:\Python27\lib\random.py", line 242, in randint
    return self.randrange(a, b+1)
  File "C:\Python27\lib\random.py", line 187, in randrange
    raise ValueError, "non-integer arg 1 for randrange()"
ValueError: non-integer arg 1 for randrange()

@Gobberwart Gobberwart mentioned this pull request Nov 9, 2016
@Gobberwart
Copy link
Contributor

Correction: works if reconnecting_timeout in config is set to default 15, or any multiple of 5, but fails if set to anything else. (5 x 0.8 = 12 (int), 5 x 1.2 = 18 (int). In my case, I have reconnecting_timeout set to 3, so 3 x 0.8 = 2.4 (float), 3 x 1.2 = 3.6 (float).

solderzzc pushed a commit that referenced this pull request Nov 11, 2016
* pokecli.py: wait_time for every exception randomized

randint(min,max)
config.reconnecting -> min
config.reconnection * 60 -> max

* randint(timeout * 0.8 * 60, timeout * 1.2 * 60; docs update
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.

7 participants