File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,21 @@ module Celestite
2020 def self.render (component : String ?, context : Celestite ::Context ? = nil , layout : String ? = nil )
2121 if renderer = @@renderer
2222 if proc = renderer.node_process
23- raise ProcessException .new(" Error rendering - node process is dead" , renderer.errors) if proc.terminated?
23+ if proc.terminated?
24+ Log .for(" celestite" ).warn { " Node process died - attempting restart..." }
25+ # Remove old process from tracking
26+ @@node_processes .delete(proc)
27+ # Start a new process
28+ new_proc = renderer.start_server
29+ @@node_processes << new_proc
30+ # Wait briefly for the new process to be ready
31+ sleep 2 .seconds
32+ # Check if new process is healthy
33+ if new_proc.terminated?
34+ raise ProcessException .new(" Error rendering - node process failed to restart" , renderer.errors)
35+ end
36+ Log .for(" celestite" ).info { " Node process restarted successfully" }
37+ end
2438 renderer.render(component, context, layout)
2539 end
2640 end
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ module Celestite
1111 getter config : Config
1212 getter node_process : Process ?
1313 getter errors = IO ::Memory .new
14+ @process_command : String = " "
1415
1516 Log = ::Log .for(" celestite" .colorize(:light_green ).to_s)
1617
You can’t perform that action at this time.
0 commit comments