Skip to content

Commit

Permalink
fix(api): sometimes the http api server not auto restart
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 authored and tiensonqin committed Apr 6, 2023
1 parent 34e8069 commit 462967e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/frontend/components/server.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
*configs (::configs _state)
{:keys [host port autostart]} @*configs
hp-changed? (or (not= host (:host server-state))
(not= (util/safe-parse-int port)
(util/safe-parse-int (:port server-state))))
(not= (util/safe-parse-int (or port 0))
(util/safe-parse-int (or (:port server-state) 0))))
changed? (or hp-changed? (->> [autostart (:autostart server-state)]
(mapv #(cond-> % (nil? %) not))
(apply not=)))]
Expand Down Expand Up @@ -126,10 +126,11 @@

(rum/use-effect!
(fn []
(ipc/ipc :server/load-state)
(let [t (js/setTimeout #(when (state/sub [:electron/server :autostart])
(ipc/ipc :server/do :restart)) 1000)]
#(js/clearTimeout t)))
(p/let [_ (p/delay 1000)
_ (ipc/ipc :server/load-state)]
(let [t (js/setTimeout #(when (state/sub [:electron/server :autostart])
(ipc/ipc :server/do :restart)) 1000)]
#(js/clearTimeout t))))
[])

(let [{:keys [status error]} server-state
Expand Down

0 comments on commit 462967e

Please sign in to comment.