refactor(modules/ipfs): use ProcessManager APIs to register and launch IPFS process

ProcessManager can be used to "register" processes and along with it, a launch function
that will be executed when a process is requested to launch.

Prior to this commit the IPFS process has not be registered and launching the process
was done manually, bypassing ProcessManager APIs.

With this commit we take advantage of ProcessManager APIs to register the IPFS process
and launch it using the `process:launch` event.
This commit is contained in:
Pascal Precht 2018-10-11 12:21:26 +02:00
parent 64d8fa3368
commit 188a688264
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 5 additions and 2 deletions

View File

@ -26,6 +26,10 @@ class IPFS {
this.addObjectToConsole();
this.registerUploadCommand();
this.events.request("processes:register", "ipfs", (cb) => {
self.startProcess(cb);
});
this._checkService((err) => {
if (!err) {
return;
@ -33,8 +37,7 @@ class IPFS {
self.logger.info("IPFS node not found, attempting to start own node");
this.listenToCommands();
this.registerConsoleCommands();
self.startProcess(() => {});
this.events.request("processes:launch", "ipfs", () => {});
this.events.request('processes:launch', 'ipfs');
});
}
}