mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
RTC-13903 Fix C9 process restarting loop (#1770)
When C9 process starts, sometimes we get a 'no connection' message, then a 'connection available' which triggers the c9 process restart.
This commit is contained in:
parent
f8db9e57d7
commit
7e495f037b
@ -20,6 +20,7 @@ class C9ShellHandler {
|
|||||||
private _c9shell: ChildProcess | undefined;
|
private _c9shell: ChildProcess | undefined;
|
||||||
private _curStatus: IShellStatus | undefined;
|
private _curStatus: IShellStatus | undefined;
|
||||||
private _isDisconnected = false;
|
private _isDisconnected = false;
|
||||||
|
private _isFreshStart = true;
|
||||||
private _isStarting = false;
|
private _isStarting = false;
|
||||||
private _isTerminating = false;
|
private _isTerminating = false;
|
||||||
private _sender: WebContents;
|
private _sender: WebContents;
|
||||||
@ -195,6 +196,7 @@ class C9ShellHandler {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this._updateStatus({ status: 'starting' });
|
this._updateStatus({ status: 'starting' });
|
||||||
|
this._isFreshStart = true;
|
||||||
const c9Shell = spawn(c9ShellPath, customC9ShellArgList, { stdio: 'pipe' });
|
const c9Shell = spawn(c9ShellPath, customC9ShellArgList, { stdio: 'pipe' });
|
||||||
|
|
||||||
c9Shell.on('close', (code) => {
|
c9Shell.on('close', (code) => {
|
||||||
@ -234,10 +236,11 @@ class C9ShellHandler {
|
|||||||
* @param c9ShellMessage Any message provided by c9-shell
|
* @param c9ShellMessage Any message provided by c9-shell
|
||||||
*/
|
*/
|
||||||
private _updateNetworkStatus(c9ShellMessage: string) {
|
private _updateNetworkStatus(c9ShellMessage: string) {
|
||||||
if (this._isDisconnected) {
|
|
||||||
if (
|
if (
|
||||||
c9ShellMessage.includes('NetworkConnectivityService|Internet Available')
|
c9ShellMessage.includes('NetworkConnectivityService|Internet Available')
|
||||||
) {
|
) {
|
||||||
|
this._isFreshStart = false;
|
||||||
|
if (this._isDisconnected) {
|
||||||
this._isDisconnected = false;
|
this._isDisconnected = false;
|
||||||
this._onNetworkReconnection();
|
this._onNetworkReconnection();
|
||||||
}
|
}
|
||||||
@ -246,7 +249,7 @@ class C9ShellHandler {
|
|||||||
'NetworkConnectivityService|No Internet Available',
|
'NetworkConnectivityService|No Internet Available',
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this._isDisconnected = true;
|
this._isDisconnected = !this._isFreshStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user