Low priority POW threads
This commit is contained in:
parent
3f5b7a5936
commit
433d55d351
|
@ -3822,7 +3822,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
if queryreturn == []:
|
if queryreturn == []:
|
||||||
return 'notFound'
|
return 'notfound'
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
status, = row
|
status, = row
|
||||||
return status
|
return status
|
||||||
|
|
|
@ -3,8 +3,21 @@ import time
|
||||||
from multiprocessing import Pool, cpu_count
|
from multiprocessing import Pool, cpu_count
|
||||||
import hashlib
|
import hashlib
|
||||||
from struct import unpack, pack
|
from struct import unpack, pack
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
def _set_idle():
|
||||||
|
try:
|
||||||
|
sys.getwindowsversion()
|
||||||
|
import win32api,win32process,win32con
|
||||||
|
pid = win32api.GetCurrentProcessId()
|
||||||
|
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
|
||||||
|
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
|
||||||
|
except:
|
||||||
|
os.nice(20)
|
||||||
|
|
||||||
def _pool_worker(nonce, initialHash, target, pool_size):
|
def _pool_worker(nonce, initialHash, target, pool_size):
|
||||||
|
_set_idle()
|
||||||
trialValue = 99999999999999999999
|
trialValue = 99999999999999999999
|
||||||
while trialValue > target:
|
while trialValue > target:
|
||||||
nonce += pool_size
|
nonce += pool_size
|
||||||
|
|
Reference in New Issue
Block a user