Skip to content

Commit

Permalink
Merge pull request #347 from GordonSmith/GH-344-DISABLE_PING
Browse files Browse the repository at this point in the history
feat:  Added pingInterval setting
  • Loading branch information
GordonSmith authored Jun 16, 2023
2 parents f618ddf + 1d675be commit 7ecbfca
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
9 changes: 3 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,21 @@
"${workspaceRoot}\\ecl-sample"
],
"outFiles": [
"${workspaceRoot}/src/**/*.js",
"${workspaceRoot}/src/notebook-renderers/**/*.js"
"${workspaceRoot}/dist/**/*.js"
]
},
{
"name": "Launch Extension With Other Extensions",
"type": "extensionHost",
"request": "launch",
"debugWebviews": true,
// path to VSCode executable
"runtimeExecutable": "${execPath}",
"args": [
// "--disable-extensions",
"--extensionDevelopmentPath=${workspaceRoot}",
"${workspaceRoot}\\ecl-sample"
],
"outFiles": [
"${workspaceRoot}/src/**/*.js",
"${workspaceRoot}/src/notebook-renderers/**/*.js"
"${workspaceRoot}/dist/**/*.js"
]
},
{
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This extension adds rich language support for [HPCC Systems](https://hpccsystems

### v2.23.x
* Added `ecl.submitNoArchive` command, submits raw content of editor to server without creating an archive first.
* Added `ecl.pingInterval` setting, allows user to change or disable the "server alive" ping.

### v2.19.x
* Added `ecl.saveOnSyntaxCheck` and `ecl.saveOnSubmit` option to ECL Settings (defaulting to off to match ECL IDE behaviour).
Expand Down Expand Up @@ -256,6 +257,9 @@ The following Visual Studio Code settings are available for the ECL extension.

// Save file prior to submission
"ecl.saveOnSubmit": false

// Ping interval (secs, -1 to disable)
"ecl.pingInterval": 5
```

#### ECL Launch Settings
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,12 @@
"default": false,
"description": "%Force global 'proxySupport' to 'fallback'%"
},
"ecl.pingInterval": {
"type": "number",
"scope": "resource",
"default": 5,
"description": "%Ping interval (secs, -1 to disable)%"
},
"dashy.libraryLocation": {
"type": "string",
"scope": "resource",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"Override eclcc auto detection": "Override eclcc auto detection",
"Pin launch configuration": "Pin launch configuration",
"Pin launch configuration to current document": "Pin launch configuration to current document",
"Ping interval (secs, -1 to disable)": "Ping interval (secs, -1 to disable)",
"Pinned launch configurations": "Pinned launch configurations",
"Private": "Private",
"Public": "Public",
Expand Down
2 changes: 1 addition & 1 deletion src/hpccplatform/launchConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";
import * as os from "os";
import * as path from "path";
import { AccountService, Activity, CodesignService, Ping, Workunit, WUQuery, WUUpdate, Topology, EclccErrors, IOptions, LogicalFile, TpLogicalClusterQuery, attachWorkspace, IECLErrorWarning, locateClientTools, ClientTools, Service, WorkunitsService } from "@hpcc-js/comms";
import { AccountService, Activity, CodesignService, Ping, Workunit, WUQuery, WUUpdate, Topology, EclccErrors, IOptions, LogicalFile, TpLogicalClusterQuery, attachWorkspace, IECLErrorWarning, locateClientTools, ClientTools, WorkunitsService } from "@hpcc-js/comms";
import { join, scopedLogger } from "@hpcc-js/util";
import { LaunchConfigState, LaunchMode, LaunchProtocol, LaunchRequestArguments } from "../debugger/launchRequestArguments";
import { showEclStatus } from "../ecl/clientTools";
Expand Down
28 changes: 19 additions & 9 deletions src/hpccplatform/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ class SessionManager {
const targetCluster = eclConfig.get<object>("targetCluster")[launchConfig];
this.switchTo(launchConfig, targetCluster);
}

if (e.affectsConfiguration("ecl.pingInterval")) {
this.monitorConnection();
}
});

const eclConfig = vscode.workspace.getConfiguration("ecl");
Expand Down Expand Up @@ -351,6 +355,20 @@ class SessionManager {
}

protected _monitor = {};
monitorConnection() {
const eclConfig = vscode.workspace.getConfiguration("ecl");
const pingInterval = eclConfig.get("pingInterval", 5);
for (const key in this._monitor) {
clearInterval(this._monitor[key]);
}
this.updateConnection();
if (!isNaN(pingInterval) && pingInterval > 0) {
this._monitor[this.session.id] = setInterval(() => {
this.updateConnection();
}, pingInterval * 1000);
}
}

switchTo(id?: string, targetCluster?: string) {
if (!this.session || this.session.id !== id) {
vscode.commands.executeCommand("setContext", "ecl.connected", false);
Expand All @@ -367,15 +385,7 @@ class SessionManager {
}
this.updateSettings();
this.refreshStatusBar();
if (!this._monitor[this.session.id]) {
for (const key in this._monitor) {
clearInterval(this._monitor[key]);
}
this.updateConnection();
this._monitor[this.session.id] = setInterval(() => {
this.updateConnection();
}, 5000);
}
this.monitorConnection();
}

updateSettings() {
Expand Down

0 comments on commit 7ecbfca

Please sign in to comment.