diff --git a/src/renderer/bisect.ts b/src/renderer/bisect.ts index d6c0b18388..56d544b7c4 100644 --- a/src/renderer/bisect.ts +++ b/src/renderer/bisect.ts @@ -53,6 +53,18 @@ export class Bisector { } } + public skip() { + const prevPivot = this.pivot; + this.pivot = + Math.floor( + Math.pow(Math.random(), 1.5) * (this.maxRev - this.minRev + 1), + ) + this.minRev; + + if (this.pivot === prevPivot && this.pivot > this.minRev) this.pivot--; + + return this.revList[this.pivot]; + } + private calculatePivot() { this.pivot = Math.floor((this.maxRev - this.minRev) / 2); } diff --git a/src/renderer/components/commands-bisect.tsx b/src/renderer/components/commands-bisect.tsx index 09cbfd9e56..311ccf78a4 100644 --- a/src/renderer/components/commands-bisect.tsx +++ b/src/renderer/components/commands-bisect.tsx @@ -51,6 +51,14 @@ export const BisectHandler = observer( } } + private skipBisect() { + window.app.runner.stop(); + const { appState } = this.props; + const response = appState.Bisector!.skip(); + + appState.setVersion(response.version); + } + private terminateBisect() { const { appState } = this.props; appState.Bisector = undefined; @@ -75,6 +83,14 @@ export const BisectHandler = observer( onClick={() => this.continueBisect(false)} disabled={isDownloading} /> +