Browse Source

Failover pool switching back delay is now configurable.

--failover-switch-delay sets the delay in seconds before switching back to a failed pool (default is 300 seconds).

Conflicts:
	miner.c
Martin Danielsen 12 years ago
parent
commit
cfb9ffc996
1 changed files with 8 additions and 4 deletions
  1. 8 4
      miner.c

+ 8 - 4
miner.c

@@ -222,6 +222,7 @@ static bool opt_submit_stale = true;
 static float opt_shares;
 static int opt_submit_threads = 0x40;
 bool opt_fail_only;
+int opt_fail_switch_delay = 300;
 bool opt_autofan;
 bool opt_autoengine;
 bool opt_noadl;
@@ -2062,6 +2063,9 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITHOUT_ARG("--failover-only",
 			opt_set_bool, &opt_fail_only,
 			"Don't leak work to backup pools when primary pool is lagging"),
+	OPT_WITH_ARG("--failover-switch-delay",
+			set_int_1_to_65535, opt_show_intval, &opt_fail_switch_delay,
+			"Delay in seconds before switching back to a failed pool"),
 #ifdef USE_FPGA
 	OPT_WITHOUT_ARG("--force-dev-init",
 	        opt_set_bool, &opt_force_dev_init,
@@ -9824,12 +9828,12 @@ static void *watchpool_thread(void __maybe_unused *userdata)
 			}
 
 			/* Only switch pools if the failback pool has been
-			 * alive for more than 5 minutes to prevent
+			 * alive for more than 5 minutes (default) to prevent
 			 * intermittently failing pools from being used. */
 			if (!pool->idle && pool_strategy == POOL_FAILOVER && pool->prio < cp_prio() &&
-			    now.tv_sec - pool->tv_idle.tv_sec > 300) {
-				applog(LOG_WARNING, "Pool %d %s stable for 5 mins",
-				       pool->pool_no, pool->rpc_url);
+			    now.tv_sec - pool->tv_idle.tv_sec > opt_fail_switch_delay) {
+				applog(LOG_WARNING, "Pool %d %s stable for %d seconds",
+				       pool->pool_no, pool->rpc_url, opt_fail_switch_delay);
 				switch_pools(NULL);
 			}
 		}