-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: loading state of start/stop daemon
- Loading branch information
Showing
17 changed files
with
357 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { ILokinetProcessManager } from './lokinetProcessManager'; | ||
|
||
export class LokinetLinuxProcessManager implements ILokinetProcessManager { | ||
async doStartLokinetProcess(): Promise<string | null> { | ||
async nodeStartLokinetProcess(): Promise<string | null> { | ||
throw new Error('Not systemd: not supported yet'); | ||
} | ||
|
||
async doStopLokinetProcess(): Promise<string | null> { | ||
async nodeStopLokinetProcess(): Promise<string | null> { | ||
throw new Error('Not systemd: not supported yet'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { ILokinetProcessManager, invoke } from './lokinetProcessManager'; | ||
|
||
export class LokinetWindowsProcessManager implements ILokinetProcessManager { | ||
doStartLokinetProcess(): Promise<string | null> { | ||
nodeStartLokinetProcess(): Promise<string | null> { | ||
return invoke('net', ['start', 'lokinet']); | ||
} | ||
|
||
doStopLokinetProcess(): Promise<string | null> { | ||
nodeStopLokinetProcess(): Promise<string | null> { | ||
return invoke('net', ['stop', 'lokinet']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export async function runForAtLeast<T>( | ||
toRun: () => Promise<T>, | ||
timer: number | ||
): Promise<T> { | ||
const atLeastPromise = sleepFor(timer); | ||
return new Promise((resolve, reject) => { | ||
Promise.allSettled([toRun(), atLeastPromise]).then((result) => { | ||
if (result[0].status === 'fulfilled') { | ||
resolve(result[0].value); | ||
} | ||
reject(result[0].status); | ||
}); | ||
}); | ||
} | ||
|
||
async function sleepFor(timeout: number) { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve('sleepFor'); | ||
}, timeout); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.