Repository: RocketMap/RocketMap

Issue:
API Watchdog check fails due to proxy -> pauses all scans
![capture](https://cloud.githubusercontent.com/assets/23256850/26150956/b2070fc0-3af8-11e7-9641-0030dcb855dd.PNG)

Watchdog check failed due to Proxy timeout. Scan now paused. No attempt to retry the check was made before I closed the scan 20 minutes later.

Now running with -novc to prevent this occurring.

Have 10 proxies in use for the scan, with the following config settings:

proxy-display: full
proxy-rotation: random
proxy-refresh: 3600

I have restarted having updated the refresh to 600 and added proxy-timeout: 15, but given that I am running with -novc I do not know if this fixes my issue.

Perhaps the watchdog needs to be retried x number of times using all available proxies in the instance of a failure, to prevent false negatives and pausing the scan.



Discussion:
Try to decrease your version-check-interval. Default is randomly set between 60 - 300s.
It should retry every version-check-interval.

Resolving patch:
diff --git a/pogom/search.py b/pogom/search.py
--- a/pogom/search.py
+++ b/pogom/search.py
@@ -502,6 +502,11 @@ def search_overseer_thread(args, new_location_queue, pause_bit, heartb,
         while pause_bit.is_set():
             for i in range(0, len(scheduler_array)):
                 scheduler_array[i].scanning_paused()
+            # API Watchdog - Continue to check API version.
+            if not args.no_version_check and not odt_triggered:
+                api_check_time = check_forced_version(args, api_version,
+                                                      api_check_time,
+                                                      pause_bit)
             time.sleep(1)
 
         # If a new location has been passed to us, get the most recent one.
@@ -575,10 +580,9 @@ def search_overseer_thread(args, new_location_queue, pause_bit, heartb,
                              scheduler_array[0])
 
         # API Watchdog - Check if Niantic forces a new API.
-        if not args.no_version_check:
+        if not args.no_version_check and not odt_triggered:
             api_check_time = check_forced_version(args, api_version,
-                                                  api_check_time, pause_bit,
-                                                  odt_triggered)
+                                                  api_check_time, pause_bit)
 
         # Now we just give a little pause here.
         time.sleep(1)
@@ -1262,9 +1266,9 @@ def stat_delta(current_status, last_status, stat_name):
     return current_status.get(stat_name, 0) - last_status.get(stat_name, 0)
 
 
-def check_forced_version(args, api_version, api_check_time, pause_bit,
-                         odt_triggered):
+def check_forced_version(args, api_version, api_check_time, pause_bit):
     if int(time.time()) > api_check_time:
+        log.debug("Checking forced API version.")
         api_check_time = int(time.time()) + args.version_check_interval
         forced_api = get_api_version(args)
 
@@ -1289,9 +1293,9 @@ def check_forced_version(args, api_version, api_check_time, pause_bit,
             else:
                 # API check was successful and
                 # installed API version is newer or equal forced API.
-                # Continue scanning if on_demand_timout isn't triggered.
-                if not odt_triggered:
-                    pause_bit.clear()
+                # Continue scanning.
+                log.debug("API check was successful. Continue scanning.")
+                pause_bit.clear()
 
         except ValueError as e:
             # Unknown version format. Pause scanning as well.


Test patch: