Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
27 lines
728 B
Plaintext
27 lines
728 B
Plaintext
import { GLOBAL_OBJ } from './worldwide.js';
|
|
|
|
/**
|
|
* Function that delays closing of a Vercel lambda until the provided promise is resolved.
|
|
*
|
|
* Vendored from https://www.npmjs.com/package/@vercel/functions
|
|
*/
|
|
function vercelWaitUntil(task) {
|
|
// We only flush manually in Vercel Edge runtime
|
|
// In Node runtime, we use process.on('SIGTERM') instead
|
|
if (typeof EdgeRuntime !== 'string') {
|
|
return;
|
|
}
|
|
const vercelRequestContextGlobal =
|
|
// @ts-expect-error This is not typed
|
|
GLOBAL_OBJ[Symbol.for('@vercel/request-context')];
|
|
|
|
const ctx = vercelRequestContextGlobal?.get?.();
|
|
|
|
if (ctx?.waitUntil) {
|
|
ctx.waitUntil(task);
|
|
}
|
|
}
|
|
|
|
export { vercelWaitUntil };
|
|
//# sourceMappingURL=vercelWaitUntil.js.map
|