Ok, so this is a patch for phoenix 1.6.1 that allows it to fallback to the primary pool after a certain number of getworks. (just like poclbm and others.)
I don't have full permissions so maybe someone will be nice enough to move it over to the phoenix thread.
diff -Naur phoenix-1.6.1/Miner.py phoenix-test/Miner.py
--- phoenix-1.6.1/Miner.py 2011-08-15 13:27:10.000000000 -0500
+++ phoenix-test/Miner.py 2011-08-18 10:34:50.000000000 -0500
@@ -42,6 +42,7 @@
self.idle = True
self.cores = []
self.backup = False
+ self.backupLife = 0
self.failures = 0
self.lastMetaRate = 0.0
self.lastRateUpdate = time()
@@ -65,6 +66,25 @@
def onWork(self, work):
self.logger.reportDebug('Server gave new work; passing to WorkQueue')
self.queue.storeWork(work)
+ if self.backup:
+ #When the backup life reaches 0, switch back to the primary pool
+ if (self.backupLife <= 0):
+ #disconnect and set connection to none
+ self.connection.disconnect()
+ self.connection = None
+
+ #log
+ self.logger.log("Backup Lifespan finished,")
+ self.logger.log("attempting to return to primary server.")
+
+ #reset failure count and return to primary server
+ self.failures = 0
+ self.backup = False
+ self.connection = self.options.makeConnection(self)
+ self.connection.connect()
+ else:
+ self.backupLife -= 1
+
def onLongpoll(self, lp):
self.logger.reportType('RPC' + (' (+LP)' if lp else ''))
def onPush(self, ignored):
@@ -73,9 +93,10 @@
self.logger.log(message)
def onDebug(self, message):
self.logger.reportDebug(message)
-
+
def failoverCheck(self):
if self.backup:
+ #The backup pool must fail 3 times before moving to the backup pool
if (self.failures >= 1):
#disconnect and set connection to none
self.connection.disconnect()
@@ -106,6 +127,10 @@
#reset failure count and connect to backup server
self.failures = 0
self.backup = True
+ self.backupLife = 20
+ if self.options.backupLife is not None:
+ self.backupLife = self.options.backupLife
+
self.connection = self.options.makeConnection(self, True)
self.connection.connect()
else:
diff -Naur phoenix-1.6.1/phoenix.py phoenix-test/phoenix.py
--- phoenix-1.6.1/phoenix.py 2011-08-15 13:27:10.000000000 -0500
+++ phoenix-test/phoenix.py 2011-08-18 10:31:29.000000000 -0500
@@ -40,6 +40,7 @@
self.parsedSettings = None
self.url = None
self.url2 = None
+ self.backupLife = None
self.logger = None
self.kernel = None
self.queue = None
@@ -57,6 +58,9 @@
parser.add_option("-b", "--backupurl", dest="url2", default=None,
help="the URL of the backup mining server to work for if the "
"primary is down [OPTIONAL]")
+ parser.add_option("-f", "--fallback", dest="backupLife", default=None,
+ help="the number of getworks when on the backup mining server "
+ "before retrying the primary server [OPTIONAL]")
parser.add_option("-q", "--queuesize", dest="queuesize", type="int",
default=1, help="how many work units to keep queued at all times")
parser.add_option("-a", "--avgsamples", dest="avgsamples", type="int",