Skip to content

Commit 4f26d2b

Browse files
committed
Add flowstorm.uiTimeoutMillis property to configure UI timeouts
1 parent be19a2e commit 4f26d2b

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- Make :preview the default visualizer for numbers
1010
- Improved thread breakpoints UX/UI
11+
- All api calls from UI have now a timeout, configurable via flowstorm.uiTimeoutMillis
1112
1213
### Bugs fixed
1314

docs/user_guide.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,7 @@ and possible values.
22192219
- `-Dflowstorm.throwOnThreadLimit=true`
22202220
- `-Dflowstorm.autoUpdateUI=false`
22212221
- `-Dflowstorm.callTreeUpdate=false`
2222+
- `-Dflowstorm.uiTimeoutMillis=4000`
22222223

22232224
== Only Clojure
22242225

docs/user_guide.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4346,6 +4346,9 @@ <h3 id="_clojure_and_clojurescript"><a class="anchor" href="#_clojure_and_clojur
43464346
<li>
43474347
<p><code>-Dflowstorm.callTreeUpdate=false</code></p>
43484348
</li>
4349+
<li>
4350+
<p><code>-Dflowstorm.uiTimeoutMillis=4000</code></p>
4351+
</li>
43494352
</ul>
43504353
</div>
43514354
</div>
@@ -4830,7 +4833,7 @@ <h2 id="_internals_diagrams_and_documentation"><a class="anchor" href="#_interna
48304833
</div>
48314834
<div id="footer">
48324835
<div id="footer-text">
4833-
Last updated 2025-05-08 09:08:03 -0300
4836+
Last updated 2025-05-09 13:05:50 -0300
48344837
</div>
48354838
</div>
48364839
</body>

src-dbg/flow_storm/debugger/main.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
styles-prop (System/getProperty "flowstorm.styles")
6767
auto-update-ui-prop (System/getProperty "flowstorm.autoUpdateUI")
6868
call-tree-update-prop (System/getProperty "flowstorm.callTreeUpdate")
69+
ui-timeout-millis (System/getProperty "flowstorm.uiTimeoutMillis")
6970
plugins-nss-set (->> (reduce-kv (fn [acc prop value]
7071
(if (str/starts-with? prop "flowstorm.plugins.namespaces")
7172
(into acc (str/split value #","))
@@ -78,6 +79,7 @@
7879
title-prop (assoc :title title-prop)
7980
auto-update-ui-prop (assoc :auto-update-ui? (= "true" auto-update-ui-prop))
8081
call-tree-update-prop (assoc :call-tree-update? (= "true" call-tree-update-prop))
82+
ui-timeout-millis (assoc :ui-timeout-millis (Long/parseLong ui-timeout-millis))
8183
(seq plugins-nss-set) (assoc :plugins-namespaces-set plugins-nss-set))))
8284

8385
(defn start-debugger

src-dbg/flow_storm/debugger/runtime_api.clj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
(declare rt-api)
2929
(declare api-call)
3030

31-
(def api-call-timeout 4000)
32-
3331
(def ^:dynamic *cache-disabled?* false)
3432

3533
(defstate rt-api
@@ -134,8 +132,9 @@
134132
the callback will be called with the response. Otherwise it will block and return the response."
135133
([call-type fkey args] (api-call call-type fkey args {} nil))
136134
([call-type fkey args opts] (api-call call-type fkey args opts nil))
137-
([call-type fkey args {:keys [cache timeout] :or {timeout 5000}} callback]
138-
(let [f (case call-type
135+
([call-type fkey args {:keys [cache]} callback]
136+
(let [timeout (:ui-timeout-millis (dbg-state/debugger-config))
137+
f (case call-type
139138
:local (dbg-api/api-fn-by-key fkey)
140139
:remote (fn [& args] (websocket/sync-remote-api-request fkey args)))
141140
debug-mode? (:debug-mode? (dbg-state/debugger-config))]
@@ -174,7 +173,7 @@
174173
RuntimeApiP
175174

176175
(runtime-config [_] (api-call :local :runtime-config []))
177-
(val-pprint [_ v opts] (api-call :local :val-pprint [v opts] {:cache api-cache :timeout api-call-timeout})) ;; CACHED
176+
(val-pprint [_ v opts] (api-call :local :val-pprint [v opts] {:cache api-cache})) ;; CACHED
178177
(data-window-push-val-data [_ dw-id val-ref extra] (api-call :local :data-window-push-val-data [dw-id val-ref (config-dw-extras extra)]))
179178
(get-form [_ form-id] (api-call :local :get-form [form-id] {:cache api-cache})) ;; CACHED
180179
(timeline-count [_ flow-id thread-id] (api-call :local :timeline-count [flow-id thread-id]))
@@ -323,7 +322,7 @@
323322
RuntimeApiP
324323

325324
(runtime-config [_] (api-call :remote :runtime-config []))
326-
(val-pprint [_ v opts] (api-call :remote :val-pprint [v opts] {:cache api-cache :timeout api-call-timeout})) ;; CACHED
325+
(val-pprint [_ v opts] (api-call :remote :val-pprint [v opts] {:cache api-cache})) ;; CACHED
327326
(data-window-push-val-data [_ dw-id val-ref extra] (api-call :remote :data-window-push-val-data [dw-id val-ref (config-dw-extras extra)]))
328327
(get-form [_ form-id] (api-call :remote :get-form [form-id] {:cache api-cache})) ;; CACHED
329328
(timeline-count [_ flow-id thread-id] (api-call :remote :timeline-count [flow-id thread-id]))

src-dbg/flow_storm/debugger/state.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
(s/def :config/debug-mode? boolean?)
175175
(s/def :config/auto-jump-on-exception? boolean?)
176176
(s/def :config/auto-update-ui? boolean?)
177+
(s/def :config/ui-timeout-millis number?)
177178
(s/def :config/pprint-previews? boolean?)
178179

179180
(s/def ::debugger-config (s/keys :req-un [:config/repl
@@ -184,6 +185,7 @@
184185
:config/pprint-previews?
185186
:config/auto-jump-on-exception?
186187
:config/auto-update-ui?
188+
:config/ui-timeout-millis
187189
:config/call-tree-update?]))
188190

189191
(s/def :bookmark/id (s/tuple :flow/id :thread/id int?))
@@ -247,7 +249,7 @@
247249
::bookmarks
248250
::data-windows]))
249251

250-
(defn initial-state [{:keys [theme styles local? port repl-type debugger-host ws-port runtime-host auto-update-ui? call-tree-update?] :as config}]
252+
(defn initial-state [{:keys [theme styles local? port repl-type debugger-host ws-port runtime-host auto-update-ui? ui-timeout-millis call-tree-update?] :as config}]
251253
{:flows {}
252254
:printers {}
253255
:selected-font-size-style-idx 0
@@ -277,6 +279,7 @@
277279
:runtime-host (or runtime-host "localhost")
278280
:debug-mode? false
279281
:auto-jump-on-exception? false
282+
:ui-timeout-millis (or ui-timeout-millis 5000)
280283
:auto-update-ui? (if-not (nil? auto-update-ui?) auto-update-ui? true)
281284
:call-tree-update? (if-not (nil? call-tree-update?) call-tree-update? true)
282285
:pprint-previews? false}

0 commit comments

Comments
 (0)