Last active
December 6, 2018 12:56
-
-
Save iperdomo/5f24c8bcb5a47262d16847f3f3d74142 to your computer and use it in GitHub Desktop.
Connection 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
diff --git a/calva/state.ts b/calva/state.ts | |
index 447e46a..f7a748e 100644 | |
--- a/calva/state.ts | |
+++ b/calva/state.ts | |
@@ -47,7 +47,8 @@ function config() { | |
projectRootDirectory: projectRootDirectoryConfig.replace(/^\/|\/$/g, ""), | |
jokerPath: configOptions.get("jokerPath"), | |
useJokerOnWSL: configOptions.get("useJokerOnWSL"), | |
- syncReplNamespaceToCurrentFile: configOptions.get("syncReplNamespaceToCurrentFile") | |
+ syncReplNamespaceToCurrentFile: configOptions.get("syncReplNamespaceToCurrentFile"), | |
+ connectionTimeout: configOptions.get("connectionTimeout") | |
}; | |
} | |
diff --git a/lib-src/calva/repl/nrepl.cljs b/lib-src/calva/repl/nrepl.cljs | |
index 6c882ea..a5de935 100644 | |
--- a/lib-src/calva/repl/nrepl.cljs | |
+++ b/lib-src/calva/repl/nrepl.cljs | |
@@ -9,11 +9,12 @@ | |
(def CONTINUATION_ERROR_MESSAGE | |
"Unexpected continuation: \"") | |
+(def DEFAULT_TIMEOUT "Default timeout in milliseconds" (* 60 1000)) | |
(defn connect | |
"Connects to a socket-based REPL at the given host (defaults to localhost) and port." | |
- [{:keys [host port on-connect on-error on-end] :or {host "localhost"}}] | |
- (doto (net/createConnection #js {:host host :port port}) | |
+ [{:keys [host port on-connect on-error on-end timeout] :or {host "localhost" timeout DEFAULT_TIMEOUT}}] | |
+ (doto (net/createConnection #js {:host host :port port :timeout timeout}) | |
(.once "connect" (fn [] | |
#_(js/console.log (str "Connected to " host ":" port)) | |
(when on-connect | |
diff --git a/package.json b/package.json | |
index 136db44..e2a9feb 100644 | |
--- a/package.json | |
+++ b/package.json | |
@@ -123,6 +123,11 @@ | |
"type": "boolean", | |
"default": false, | |
"description": "Specifies if Joker will run through WSL" | |
+ }, | |
+ "calva.connectionTimeout": { | |
+ "type": "number", | |
+ "default": 60000, | |
+ "description": "Sets the connection timeout (in milliseconds)" | |
} | |
} | |
}, | |
@@ -363,4 +368,4 @@ | |
"shadow-cljs": "^2.4.8", | |
"typescript": "^2.9.2" | |
} | |
-} | |
\ No newline at end of file | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment