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:
parent
64d8fa3368
commit
188a688264
|
@ -26,6 +26,10 @@ class IPFS {
|
||||||
this.addObjectToConsole();
|
this.addObjectToConsole();
|
||||||
this.registerUploadCommand();
|
this.registerUploadCommand();
|
||||||
|
|
||||||
|
this.events.request("processes:register", "ipfs", (cb) => {
|
||||||
|
self.startProcess(cb);
|
||||||
|
});
|
||||||
|
|
||||||
this._checkService((err) => {
|
this._checkService((err) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
return;
|
return;
|
||||||
|
@ -33,8 +37,7 @@ class IPFS {
|
||||||
self.logger.info("IPFS node not found, attempting to start own node");
|
self.logger.info("IPFS node not found, attempting to start own node");
|
||||||
this.listenToCommands();
|
this.listenToCommands();
|
||||||
this.registerConsoleCommands();
|
this.registerConsoleCommands();
|
||||||
self.startProcess(() => {});
|
this.events.request('processes:launch', 'ipfs');
|
||||||
this.events.request("processes:launch", "ipfs", () => {});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue