← Files RivetARCHIVED FILE

node_modules/rivet-design/dist/cli/serverShutdown.js

893 Bytes · Nov 7, 2026 · 13:16 UTC

↓ Download file

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForServerShutdown = exports.DEFAULT_SHUTDOWN_TIMEOUT_MS = void 0;
const client_1 = require("./client");
const serverHandshake_1 = require("./serverHandshake");
const SHUTDOWN_POLL_MS = 100;
exports.DEFAULT_SHUTDOWN_TIMEOUT_MS = 10_000;
const waitForServerShutdown = async (attached, timeoutMs = exports.DEFAULT_SHUTDOWN_TIMEOUT_MS) => {
    (0, client_1.invalidateAttachCache)();
    const deadline = Date.now() + timeoutMs;
    while ((0, serverHandshake_1.isPidAlive)(attached.handshake.pid)) {
        if (Date.now() >= deadline)
            return false;
        await new Promise((resolve) => setTimeout(resolve, SHUTDOWN_POLL_MS));
    }
    (0, client_1.invalidateAttachCache)();
    return true;
};
exports.waitForServerShutdown = waitForServerShutdown;
//# sourceMappingURL=serverShutdown.js.map

SHA-256: 470c3a311b4d080d20c46a2315075afac834b2f24a81360ac2aad234e926314f