Repository: PokemonGoF/PokemonGo-Bot

Issue:
Looped spin fort and move to fort. Endless "Possibly searching too often, take a rest."
<!--

STOP ! ! !

Read the following before creating anything (or you will have your issue/feature request closed without notice)

1. Please only create an ISSUE or a FEATURE REQUEST - don't mix the two together in one item
2. For a Feature Request please only fill out the FEATURE REQUEST section
3. For a Issue please only fill out the ISSUE section
4. Issues are NOT to be used for help/config problems/support - use the relevant slack channels as per the README
5. Provide a good summary in the title, don't just write problem, or awesome idea!
6. Delete all irrelevant sections not related to your issue/feature request (including this top section)

===============ISSUE SECTION===============

Before you create an Issue, please check the following:

1. Have you validated that your config.json is valid JSON? Use http://jsonlint.com/ to check.
2. Have you [searched our issue tracker](https://github.com/PokemonGoF/PokemonGo-Bot/issues?q=is%3Aissue+sort%3Aupdated-desc) to see if the issue already exists? If so, comment on that issue instead rather than creating a new issue.
3. Are you running on the `master` branch? We work on the `dev` branch and then add that functionality to `master` when it is stable. Your issue may be fixed on `dev` and there is no need for this issue, just wait and it will eventually be merged to `master`.
4. All Issue sections MUST be completed to help us determine the actual problem and find its cause
-->
### Expected Behavior

<!-- Tell us what you expect to happen -->

Spin the current fort and go to another (like it was some days before)
### Actual Behavior

<!-- Tell us what is happening -->

Looped move to fort / spinning. Bot can be stuck in this state for like 30 minutes continuously trying to spin the fort.
### Your FULL config.json (remove your username, password, gmapkey and any other private info)

<!-- Provide your FULL config file, feel free to use services such as pastebin.com to reduce clutter -->

http://pastebin.com/2gc6gaaP
### Output when issue occurred

2016-08-21 22:07:29,914 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Vse Dla Fronta - 0.04km
2016-08-21 22:07:31,357 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:31,363 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:33,051 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:33,060 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Vse Dla Fronta - 0.04km
2016-08-21 22:07:35,968 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:35,974 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:37,807 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:37,813 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:40,849 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:40,857 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Vse Dla Fronta - 0.04km
2016-08-21 22:07:42,715 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:42,722 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:44,585 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:44,591 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:46,203 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:46,209 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Vse Dla Fronta - 0.04km
2016-08-21 22:07:48,157 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:48,163 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:50,885 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:50,891 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Vse Dla Fronta - 0.04km
2016-08-21 22:07:52,325 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:52,331 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:54,024 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:54,030 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:55,895 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
2016-08-21 22:07:55,904 [MoveToFort] [INFO] [arrived_at_fort] Arrived at fort.
2016-08-21 22:07:57,741 [  SpinFort] [INFO] [pokestop_searching_too_often] Possibly searching too often, take a rest.
### Steps to Reproduce

<!-- Tell us the steps you have taken to reproduce the issue -->

Install using setup.sh from dev branch and just launch bot with my config. After 1-2 min bot will stuck
### Other Information

OS: 
MacOS
Branch: 
dev
Git Commit: 
3fcc2901c0f1afc14225c5455c6d2bebbedf5500
Python Version: 
Python 2.7.12 
Any other relevant files/configs (eg: path files) 

<!-- Anything else which may be of relevance -->



Discussion:
I have the same. Bot go ahead after a few minutes as pokestop to renew.

IP ban. Change your IP.

This is not Ip Ban. Bot move normally. Only under specific conditions, crashes. Between the two pokestop Which are spaced less than 0.08km.

This one keeps coming back

Can you try altering your config the following:

```
    "type": "SpinFort",
    "config": {
      "spin_wait_min": 3,
      "spin_wait_max": 6
```

and let me know if the problem happens again. 


Resolving patch:
diff --git a/pokemongo_bot/cell_workers/spin_fort.py b/pokemongo_bot/cell_workers/spin_fort.py
--- a/pokemongo_bot/cell_workers/spin_fort.py
+++ b/pokemongo_bot/cell_workers/spin_fort.py
@@ -150,17 +150,15 @@ def work(self):
                         'softban',
                         formatted='Probably got softban.'
                     )
-                with self.bot.database as conn:
-                    c = conn.cursor()
-                    c.execute("SELECT COUNT(name) FROM sqlite_master WHERE type='table' AND name='softban_log'")
-                result = c.fetchone()        
-
-                while True:
+                    with self.bot.database as conn:
+                        c = conn.cursor()
+                        c.execute("SELECT COUNT(name) FROM sqlite_master WHERE type='table' AND name='softban_log'")
+                    result = c.fetchone()        
+                    
                     if result[0] == 1:
                         source = str("PokemonCatchWorker")
                         status = str("Possible Softban")
                         conn.execute('''INSERT INTO softban_log (status, source) VALUES (?, ?)''', (status, source))
-                        break
                     else:
                         self.emit_event(
                         'softban_log',
@@ -168,9 +166,9 @@ def work(self):
                         level='info',
                         formatted="softban_log table not found, skipping log"
                         )
-                        break
-                else:
-                    self.bot.fort_timeouts[fort["id"]] = (time.time() + 300) * 1000  # Don't spin for 5m
+                        
+                self.bot.fort_timeouts[fort["id"]] = (time.time() + 300) * 1000  # Don't spin for 5m
+                    
                 return WorkerResult.ERROR
         action_delay(self.spin_wait_min, self.spin_wait_max)
 


Test patch: