Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Run git commands in dedicated renderer process #688

Merged
merged 82 commits into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
c07d65b
WIP compare renderer and child process IPC times
kuychaco Apr 13, 2017
53384de
WIP shell out to git in renderer process
kuychaco Apr 13, 2017
519ebfc
WIP Create RendererProcessManager
kuychaco Apr 14, 2017
c9b2978
:arrow_up: atom-mocha-test-runner@1.0.1
kuychaco Apr 17, 2017
f91e8cd
Make RendererProcessManager a singleton
kuychaco Apr 17, 2017
8fe00d5
Actually import GitError
kuychaco Apr 17, 2017
e9aa22d
Use import instead of require
kuychaco Apr 17, 2017
169ab20
Don't show browser window for git renderer process
kuychaco Apr 18, 2017
72b5ccc
WIP wtf is up w/ the tests
kuychaco Apr 19, 2017
761ff7d
Wait for renderer process to be ready before sending Git commands
BinaryMuse Apr 19, 2017
54c1653
Destroy any Repositories created during tests after each test
BinaryMuse Apr 19, 2017
09fdc01
No need to reset singleton RendererProcessManager after each test
BinaryMuse Apr 19, 2017
197b332
Conditionally choose exec strategy
BinaryMuse Apr 19, 2017
364b086
Fix global test setup
BinaryMuse Apr 19, 2017
ed4c5ed
Extract Git execution into a separate method for stubbing
BinaryMuse Apr 19, 2017
ca3411c
Un-pend test
BinaryMuse Apr 19, 2017
bc7ae77
Fix flaky test
BinaryMuse Apr 19, 2017
3bda0a9
:art:
BinaryMuse Apr 19, 2017
2228185
:fire: git-child-process.js
kuychaco Apr 19, 2017
325f48b
:art: and clean up
kuychaco Apr 19, 2017
2bd9e37
More clean up
kuychaco Apr 19, 2017
684ca4a
:fire: comments
kuychaco Apr 19, 2017
6494404
Remove type property from ipc data and rely on channel to identify type
kuychaco Apr 19, 2017
e7074b7
:fire: unused changes to GitTimingsView
kuychaco Apr 19, 2017
5d2fef3
Actually, we want to test that...
kuychaco Apr 19, 2017
9b3a288
Put those timeouts back
kuychaco Apr 19, 2017
0187c4b
Mo :art:
kuychaco Apr 19, 2017
de1918b
Communicate on ipc channel based on renderer's web contents id
kuychaco Apr 19, 2017
b86ad95
Delete entry in RendererProcessManager map after promise is resolved
kuychaco Apr 19, 2017
66a1a08
rendererWebContentsId -> childWebContentsID
kuychaco Apr 19, 2017
ff425c4
Move operation management from RendererProcessManager into RendererPr…
kuychaco Apr 20, 2017
bcd2722
WIP Implement logic for creating new renderer process
kuychaco Apr 20, 2017
8bfa4ae
Merge branch 'master' into ku-renderer-shell-out
kuychaco Apr 20, 2017
4557f46
Refactor RendererProcessManager -> WorkerManager. Handle destroyed pr…
kuychaco Apr 21, 2017
097714d
Set operation to pending after call to GitProcess.exec
kuychaco Apr 22, 2017
ce2bcc3
Wait for all write operations to finish before destroying renderer pr…
kuychaco Apr 22, 2017
8e211a1
Add test for fallback when worker process crashes
kuychaco Apr 24, 2017
e43c271
Destroy RendererProcess instance on 'crashed' event
kuychaco Apr 25, 2017
6505e04
Add test for handling when a worker is sick
kuychaco Apr 25, 2017
23026e2
Execute remaining operations in newly active worker when sick process…
kuychaco Apr 25, 2017
7b29cc7
Use global sinon
kuychaco Apr 25, 2017
045c009
Destroy worker managers in tests
kuychaco Apr 25, 2017
1038161
Don't care if operation is a write
kuychaco Apr 25, 2017
29c36bb
Add test for ensuring that operations are complete before destroying …
kuychaco Apr 25, 2017
cd71d68
Rename renderer.js to worker.js
kuychaco Apr 25, 2017
77fdc0d
Add test case for killing renderer processes when worker manager crashes
kuychaco Apr 25, 2017
0bb8e57
Show browser windows if process.env.ATOM_GITHUB_SHOW_RENDERER_WINDOW …
kuychaco Apr 25, 2017
d11877e
Don't create new worker if WorkerManager is destroyed
kuychaco Apr 25, 2017
80956e2
Don't open dev tools
kuychaco Apr 25, 2017
94e0b8b
:art: move destroy method to bottom
kuychaco Apr 25, 2017
53bf504
:art:
kuychaco Apr 25, 2017
5db1010
Merge remote-tracking branch 'origin/master' into ku-renderer-shell-out
BinaryMuse Apr 25, 2017
920b4ca
:fire: .only
BinaryMuse Apr 25, 2017
91908e5
:fire: error when pushing into a disposed AsyncQueue
BinaryMuse Apr 25, 2017
d868091
Fix failure to clone when target folder doesn't exist
BinaryMuse Apr 25, 2017
c991157
Let the worker window tell us what it's doing
BinaryMuse Apr 25, 2017
5743cb3
Destroy the old WorkerManager before creating a new one.
BinaryMuse Apr 25, 2017
dca043e
Stub Operation.prototype.execute instead of complete
kuychaco Apr 25, 2017
fc16dd5
Throw error in isProcessAlive helper if pid is not a number
kuychaco Apr 25, 2017
a0df97c
Decouple completing operation and post-completion cleanup tasks
kuychaco Apr 25, 2017
652459d
Use static channelName for all ipc communication
kuychaco Apr 25, 2017
7e7d4ce
Dispose of webContents listeners before destroying manager window
kuychaco Apr 25, 2017
aa09a96
Fix test
kuychaco Apr 25, 2017
863209d
Fix other test
kuychaco Apr 25, 2017
bc3073c
Merge branch 'ku-renderer-shell-out' of github.com:atom/github into k…
kuychaco Apr 25, 2017
55f9882
Include sourceWebContentsId in git data ipc message
kuychaco Apr 25, 2017
6502cbf
Don't show browser window
kuychaco Apr 25, 2017
c3b875e
Don't reject promise for remaining operations during destroy
kuychaco Apr 25, 2017
b7f4b20
:fire: RendererProcessManager
kuychaco Apr 25, 2017
5e34e0e
Force reset of WorkerManager after tests complete
kuychaco Apr 25, 2017
6359895
Implement WorkerManager.prototype.isReady
kuychaco Apr 25, 2017
c39aaf6
Shell out in process if WorkerManager instance isn't ready
kuychaco Apr 25, 2017
95fb731
Don't await ready promise in RendererProcess#executeOperation
kuychaco Apr 25, 2017
7a95446
First hacky pass at IPC-based Git timings
BinaryMuse Apr 26, 2017
5d309d1
:shirt:
kuychaco Apr 26, 2017
3066270
Don't clog up IPC channel with 'exec-started' events
kuychaco Apr 26, 2017
4084aec
Destroy WorkerManager in deactivate
kuychaco Apr 26, 2017
8727017
Add console.warn to indicate sick worker
kuychaco Apr 27, 2017
7bab3da
:keyboard:
kuychaco Apr 27, 2017
1740e9b
Use assert.lengthOf
kuychaco Apr 27, 2017
c3b4b23
Merge branch 'master' into ku-renderer-shell-out
kuychaco Apr 27, 2017
e708668
Only log about sick worker if not in spec mode
kuychaco Apr 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement WorkerManager.prototype.isReady
  • Loading branch information
kuychaco authored and BinaryMuse committed Apr 25, 2017
commit 6359895cc49c40b5b3a0c7cd89eeeabe0f1ade46
18 changes: 18 additions & 0 deletions lib/worker-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export default class WorkerManager {
this.createNewWorker();
}

isReady() {
return this.activeWorker.isReady();
}

request(data) {
if (this.destroyed) { throw new Error('Worker is destroyed'); }
let operation;
Expand Down Expand Up @@ -82,6 +86,10 @@ export default class WorkerManager {
return this.activeWorker;
}

getReadyPromise() {
return this.activeWorker.getReadyPromise();
}

destroy(force) {
this.destroyed = true;
this.workers.forEach(worker => worker.destroy(force));
Expand Down Expand Up @@ -112,6 +120,10 @@ export class Worker {
});
}

isReady() {
return this.rendererProcess.isReady();
}

getLoadUrl(operationCountLimit) {
const htmlPath = path.join(getPackageRoot(), 'lib', 'renderer.html');
const rendererJsPath = path.join(getPackageRoot(), 'lib', 'worker.js');
Expand Down Expand Up @@ -234,9 +246,14 @@ export class RendererProcess {
this.emitter,
);

this.ready = false;
this.readyPromise = new Promise(resolve => { this.resolveReady = resolve; });
}

isReady() {
return this.ready;
}

@autobind
handleDestroy(...args) {
this.destroy();
Expand All @@ -253,6 +270,7 @@ export class RendererProcess {
ipc.on(Worker.channelName, handleMessages);
this.emitter.on('renderer-ready', ({pid}) => {
this.pid = pid;
this.ready = true;
this.resolveReady();
});
this.emitter.on('git-data', this.onData);
Expand Down
13 changes: 13 additions & 0 deletions test/worker-manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ describe('WorkerManager', function() {
workerManager.destroy(true);
});

describe('isReady()', function() {
it('returns true if its worker is ready', async function() {
assert.isFalse(workerManager.isReady());
await workerManager.getReadyPromise();
assert.isTrue(workerManager.isReady());

workerManager.onSick(workerManager.getActiveWorker());
assert.isFalse(workerManager.isReady());
await workerManager.getReadyPromise();
assert.isTrue(workerManager.isReady());
});
});

describe('when a worker process crashes', function() {
it('creates a new worker process (with the same operation count limit) and executes remaining operations', async function() {
workerManager.createNewWorker({operationCountLimit: 40});
Expand Down