Commit 4353a34
committed
refactor(server_lifecycle): Introduce graceful server shutdown and port management
Changes to entrypoint.sh:
- Implemented wait_for_ports_free function for ensuring ports are free before starting or restarting the server.
- Added constants for UDP and TCP ports, SHUTDOWN_TIMEOUT variable.
- Modified start_server() function to start the server gracefully with a timeout.
- Modified stop_server() function to gracefully stop the server, ask nicely first, and wait for it to finish before continuing. If the server does not stop within the specified time, it will be force killed.
- Added wait_for_ports_free after stopping the server to ensure ports are free before starting a new server instance or exiting the script.
These changes improve the server's graceful shutdown and port management for a smoother user experience.1 parent ebe96c9 commit 4353a34
1 file changed
+51
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
103 | 120 | | |
104 | 121 | | |
105 | 122 | | |
| |||
108 | 125 | | |
109 | 126 | | |
110 | 127 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
115 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
116 | 158 | | |
117 | 159 | | |
118 | 160 | | |
| |||
123 | 165 | | |
124 | 166 | | |
125 | 167 | | |
| 168 | + | |
126 | 169 | | |
127 | | - | |
| 170 | + | |
| 171 | + | |
128 | 172 | | |
129 | 173 | | |
| 174 | + | |
130 | 175 | | |
131 | 176 | | |
0 commit comments