Skip to content

Commit 42e05be

Browse files
Merge pull request #45 from pulsar-edit/disable-worker-manager
Soft-disable `WorkerManager`…
2 parents 5c1590c + 6da72b8 commit 42e05be

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/git-shell-out-strategy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export default class GitShellOutStrategy {
379379
}
380380

381381
executeGitCommand(args, options, marker = null) {
382-
if (process.env.ATOM_GITHUB_INLINE_GIT_EXEC || !WorkerManager.getInstance().isReady()) {
382+
if (process.env.ATOM_GITHUB_INLINE_GIT_EXEC || !WorkerManager.isEnabled() || !WorkerManager.getInstance().isReady()) {
383383
marker && marker.mark('nexttick');
384384

385385
let childPid;

lib/worker-manager.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,24 @@ import {Emitter, Disposable, CompositeDisposable} from 'event-kit';
77

88
import {getPackageRoot, autobind} from './helpers';
99

10+
// Whether `WorkerManager` is enabled. If not, it will never mark itself as
11+
// ready, and `GitShellOutStrategy` will use its fallback approach of spawning
12+
// `git` processes more directly via `dugite` (which works fine). This allows
13+
// us to bail without even trying to start another renderer process.
14+
//
15+
// NOTE: For the reasons explained in
16+
// https://github.com/pulsar-edit/github/pull/45, `WorkerManager` is now
17+
// permanently disabled. This automatically triggers the fallback strategy
18+
// described above and is a prelude to the removal of `WorkerManager` entirely.
19+
const ENABLED = false;
20+
1021
export default class WorkerManager {
1122
static instance = null;
1223

24+
static isEnabled () {
25+
return ENABLED;
26+
}
27+
1328
static getInstance() {
1429
if (!this.instance) {
1530
this.instance = new WorkerManager();
@@ -123,6 +138,7 @@ export class Worker {
123138
this.completedOperationCount = 0;
124139
this.sick = false;
125140

141+
if (!ENABLED) return;
126142
this.rendererProcess = new RendererProcess({
127143
loadUrl: this.getLoadUrl(operationCountLimit),
128144
onData: this.handleDataReceived,
@@ -137,6 +153,7 @@ export class Worker {
137153
}
138154

139155
isReady() {
156+
if (!ENABLED) return false;
140157
return this.rendererProcess.isReady();
141158
}
142159

0 commit comments

Comments
 (0)