MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / exit

Method exit

daemon/src/service/system_instance.ts:280–317  ·  view source on GitHub ↗
(force = false)

Source from the content-addressed store, hash-verified

278 }
279
280 exit(force = false) {
281 const promises: Promise<void>[] = [];
282 for (const iterator of this.instances) {
283 const instance = iterator[1];
284 if (instance.status() !== Instance.STATUS_STOP) {
285 promises.push(this.exitInstance(instance, force));
286 }
287 }
288 Promise.all(promises);
289
290 return new Promise<void>((resolve) => {
291 let checkCount = 0;
292 const checkTask = setInterval(() => {
293 let count = 0;
294 checkCount++;
295 for (const [_, instance] of this.instances) {
296 if (instance.status() !== Instance.STATUS_STOP) {
297 count++;
298 if (checkCount > 10) {
299 logger.info(
300 $t("TXT_CODE_eadac3c2", {
301 instance: instance.config.nickname
302 })
303 );
304 this.exitInstance(instance, true);
305 }
306 }
307 }
308 if (count === 0) {
309 logger.info($t("TXT_CODE_187bb567"));
310 clearInterval(checkTask);
311 resolve();
312 } else {
313 logger.info($t("TXT_CODE_6f23ce93", { count }));
314 }
315 }, 1000);
316 });
317 }
318
319 // Soft exit: optional docker skip and configurable wait timeout
320 softExit(skipDocker = true, waitSeconds = 10) {

Callers

nothing calls this directly

Calls 5

exitInstanceMethod · 0.95
$tFunction · 0.90
infoMethod · 0.80
statusMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected