Skip to content
Snippets Groups Projects
Unverified Commit 9871890e authored by Éloïs's avatar Éloïs
Browse files

[fix] #1256force sync for cancelWork job

parent 700d6df3
No related branches found
No related tags found
1 merge request!1238Resolve "the 1.6.15 and 1.6.16 versions never starts the calculation of blocks"
...@@ -67,8 +67,8 @@ export class WorkerFarm { ...@@ -67,8 +67,8 @@ export class WorkerFarm {
/** /**
* Eventually stops the engine PoW if one was computing * Eventually stops the engine PoW if one was computing
*/ */
stopPoW() { async stopPoW() {
this.stopPromise = querablep(this.theEngine.cancel()) this.stopPromise = querablep(Promise.resolve(this.theEngine.cancel()))
return this.stopPromise; return this.stopPromise;
} }
...@@ -133,10 +133,10 @@ export class BlockProver { ...@@ -133,10 +133,10 @@ export class BlockProver {
if (this.workerFarmPromise) { if (this.workerFarmPromise) {
let farm = await this.getWorker(); let farm = await this.getWorker();
if (farm.isComputing() && !farm.isStopping()) { if (farm.isComputing() && !farm.isStopping()) {
await farm.stopPoW() Promise.resolve(farm.stopPoW())
} else { } else {
// We force the stop anyway, just to be sure // We force the stop anyway, just to be sure
await farm.stopPoW() Promise.resolve(farm.stopPoW())
} }
if (this.waitResolve) { if (this.waitResolve) {
this.waitResolve(); this.waitResolve();
......
...@@ -33,11 +33,11 @@ export class PowEngine { ...@@ -33,11 +33,11 @@ export class PowEngine {
} }
async prove(stuff:any) { async prove(stuff:any) {
this.cluster.cancelWork() Promise.all([this.cluster.cancelWork()])
return await this.cluster.proveByWorkers(stuff) return await this.cluster.proveByWorkers(stuff)
} }
cancel() { async cancel() {
return this.cluster.cancelWork() return this.cluster.cancelWork()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment