@@ -92,7 +92,9 @@ class CGMiner(Miner):
9292 keys = ['temps' , 'hashrates' ]
9393 valid_collectors = ['status' ]
9494
95- def __init__ (self , collectors , remotes , port = 4028 , address = '127.0.0.1' ):
95+ def __init__ (self , collectors , remotes , thresholds = None , port = 4028 ,
96+ address = '127.0.0.1' ):
97+ self .thresholds = thresholds or {}
9698 self .port = port
9799 self .remotes = remotes
98100 self .address = address
@@ -104,12 +106,14 @@ def __init__(self, collectors, remotes, port=4028, address='127.0.0.1'):
104106 self .queue = []
105107 self .authenticated = False
106108 self .last_devs = []
109+ self .sent_thresholds = False
107110
108111 def reset (self ):
109112 """ Called when connection to the miner is lost for some reason """
110113 self .last_devs = []
111114 self ._worker = None
112115 self .authenticated = False
116+ self .sent_thresholds = False
113117
114118 def reset_timers (self ):
115119 now = int (time .time ())
@@ -126,8 +130,12 @@ def worker(self):
126130 def collect (self ):
127131 # trim queue to keep it from growing infinitely while disconnected
128132 self .queue = self .queue [:10 ]
129-
130133 now = int (time .time ())
134+
135+ if self .sent_thresholds is False :
136+ self .queue .append ([self .worker , 'thresholds' , self .thresholds , now ])
137+ self .sent_thresholds = True
138+
131139 # if it's time to run, and we have status defined
132140 if ('status' in self .collectors or
133141 'temp' in self .collectors or
0 commit comments