Se añade un event listener que loggea cuando se va a apagar la función
This commit is contained in:
@@ -19,6 +19,13 @@ type NivelType =
|
||||
type TipoCicloType =
|
||||
Database["public"]["Tables"]["planes_estudio"]["Insert"]["tipo_ciclo"];
|
||||
|
||||
addEventListener("beforeunload", (ev: any) => {
|
||||
// ev.detail.reason te dirá si es "timeout", "memory_limit" o "idle"
|
||||
console.error("ALERTA: La función se va a apagar. Razón:", ev.detail?.reason);
|
||||
|
||||
// Aquí puedes intentar un último log antes de que todo muera
|
||||
});
|
||||
|
||||
Deno.serve(async (req: Request): Promise<Response> => {
|
||||
const url = new URL(req.url);
|
||||
const functionName = url.pathname.split("/").pop();
|
||||
|
||||
@@ -9,6 +9,13 @@ import {
|
||||
type StructuredResponseOptions,
|
||||
} from "../_shared/openai-service.ts";
|
||||
|
||||
addEventListener("beforeunload", (ev: any) => {
|
||||
console.error(
|
||||
"ALERTA: La función se va a apagar. Razón:",
|
||||
ev?.detail?.reason,
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* JSON input signature (when `Content-Type: application/json`)
|
||||
*
|
||||
|
||||
@@ -22,6 +22,13 @@ type AddMessageBody = {
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
addEventListener("beforeunload", (ev: any) => {
|
||||
console.error(
|
||||
"ALERTA: La función se va a apagar. Razón:",
|
||||
ev?.detail?.reason,
|
||||
);
|
||||
});
|
||||
|
||||
// Preflight CORS
|
||||
app.options(
|
||||
"*",
|
||||
|
||||
@@ -10,6 +10,13 @@ import {
|
||||
type StructuredResponseOptions,
|
||||
} from "../_shared/openai-service.ts";
|
||||
|
||||
addEventListener("beforeunload", (ev: any) => {
|
||||
console.error(
|
||||
"ALERTA: La función se va a apagar. Razón:",
|
||||
ev?.detail?.reason,
|
||||
);
|
||||
});
|
||||
|
||||
export type DataAsignaturaSugerida = {
|
||||
nombre: Tables<"asignaturas">["nombre"];
|
||||
codigo?: Tables<"asignaturas">["codigo"];
|
||||
|
||||
Reference in New Issue
Block a user