Fix python PoW
- recent changes cause the pool workers to trigger shutdown and freeze. Now python PoW works again
This commit is contained in:
parent
685ff6cecd
commit
b8a08a0ce9
|
@ -60,10 +60,22 @@ def _doFastPoW(target, initialHash):
|
||||||
maxCores = 99999
|
maxCores = 99999
|
||||||
if pool_size > maxCores:
|
if pool_size > maxCores:
|
||||||
pool_size = maxCores
|
pool_size = maxCores
|
||||||
|
|
||||||
|
# temporarily disable handlers
|
||||||
|
int_handler = signal.getsignal(signal.SIGINT)
|
||||||
|
term_handler = signal.getsignal(signal.SIGTERM)
|
||||||
|
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||||
|
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
||||||
|
|
||||||
pool = Pool(processes=pool_size)
|
pool = Pool(processes=pool_size)
|
||||||
result = []
|
result = []
|
||||||
for i in range(pool_size):
|
for i in range(pool_size):
|
||||||
result.append(pool.apply_async(_pool_worker, args = (i, initialHash, target, pool_size)))
|
result.append(pool.apply_async(_pool_worker, args = (i, initialHash, target, pool_size)))
|
||||||
|
|
||||||
|
# re-enable handlers
|
||||||
|
signal.signal(signal.SIGINT, int_handler)
|
||||||
|
signal.signal(signal.SIGTERM, term_handler)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if shutdown >= 1:
|
if shutdown >= 1:
|
||||||
pool.terminate()
|
pool.terminate()
|
||||||
|
|
Reference in New Issue
Block a user