backend-defaults: immediately close connections on shutdown in local dev

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-12-16 10:47:51 +01:00
parent d871eb618f
commit 5b1e68c8c2
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-defaults': patch
---
Immediately close all connections when shutting down in local development.
@@ -53,6 +53,12 @@ export async function createHttpServer(
stop() {
return new Promise<void>((resolve, reject) => {
if (process.env.NODE_ENV === 'development') {
// Ensure that various polling connections are shut down fast in development
server.closeAllConnections();
} else {
server.closeIdleConnections();
}
server.close(error => {
if (error) {
reject(error);