Skip to content
Snippets Groups Projects
Commit 7b597352 authored by Éloïs's avatar Éloïs
Browse files

[fix] #1256force sync for cancelWork job

parent 8e879c3e
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 {
/**
* Eventually stops the engine PoW if one was computing
*/
stopPoW() {
this.stopPromise = querablep(this.theEngine.cancel())
async stopPoW() {
this.stopPromise = querablep(Promise.resolve(this.theEngine.cancel()))
return this.stopPromise;
}
......@@ -133,10 +133,10 @@ export class BlockProver {
if (this.workerFarmPromise) {
let farm = await this.getWorker();
if (farm.isComputing() && !farm.isStopping()) {
await farm.stopPoW()
Promise.resolve(farm.stopPoW())
} else {
// We force the stop anyway, just to be sure
await farm.stopPoW()
Promise.resolve(farm.stopPoW())
}
if (this.waitResolve) {
this.waitResolve();
......
......@@ -33,11 +33,11 @@ export class PowEngine {
}
async prove(stuff:any) {
this.cluster.cancelWork()
Promise.all([this.cluster.cancelWork()])
return await this.cluster.proveByWorkers(stuff)
}
cancel() {
async cancel() {
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