We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd59c8c commit aa453e9Copy full SHA for aa453e9
src/index.ts
@@ -137,11 +137,17 @@ function manageBackgroundServices(
137
shutdownTimer = undefined;
138
}
139
140
+ // We do a two-step timer here: 1 minute then a logged warning, then 9 more minutes
141
+ // until an automatic server shutdown:
142
shutdownTimer = setTimeout(() => {
- if (activeSessions === 0) {
143
+ if (activeSessions !== 0) return;
144
+ console.log('Server is inactive, preparing for auto-shutdown...');
145
+
146
+ shutdownTimer = setTimeout(() => {
147
148
shutdown(99, '10 minutes inactive');
- }
- }, 1000 * 60 * 10).unref();
149
+ }, 1000 * 60 * 9).unref();
150
+ }, 1000 * 60 * 1).unref();
151
152
});
153
0 commit comments