| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import { type Context, type Handler } from "aws-lambda";
- import config from "./config";
- import { handler as horas24 } from "./portales/24horas/handler";
- import { handler as adnradio } from "./portales/adnradio/handler";
- import { handler as biobiochile } from "./portales/biobiochile/handler";
- import { handler as chilecultura } from "./portales/chilecultura/handler";
- import { handler as ciper } from "./portales/ciper/handler";
- import { handler as codexverde } from "./portales/codexverde/handler";
- import { handler as contrapoder } from "./portales/contrapoder/handler";
- import { handler as cooperativa } from "./portales/cooperativa/handler";
- import { handler as df } from "./portales/df/handler";
- import { handler as elciudadano } from "./portales/elciudadano/handler";
- import { handler as eldesconcierto } from "./portales/eldesconcierto/handler";
- import { handler as elmostrador } from "./portales/elmostrador/handler";
- import { handler as emol } from "./portales/emol/handler";
- import { handler as fastcheck } from "./portales/fastcheck/handler";
- // import { handler as glaciareschilenos } from "./portales/glaciareschilenos/handler";
- import { handler as interferencia } from "./portales/interferencia/handler";
- import { handler as laderasur } from "./portales/laderasur/handler";
- import { handler as lanacion } from "./portales/lanacion/handler";
- import { handler as latercera } from "./portales/latercera/handler";
- import { handler as meteored } from "./portales/meteored/handler";
- // import { handler as metrodesantiago } from "./portales/metrodesantiago/handler";
- import { handler as resumen } from "./portales/resumen/handler";
- import { handler as tarreo } from "./portales/tarreo/handler";
- import { handler as theclinic } from "./portales/theclinic/handler";
- const context: Context = {
- callbackWaitsForEmptyEventLoop: false,
- functionName: "",
- functionVersion: "",
- invokedFunctionArn: "",
- memoryLimitInMB: "0",
- awsRequestId: "",
- logGroupName: "",
- logStreamName: "",
- done: () => { },
- fail: () => { },
- succeed: () => { },
- getRemainingTimeInMillis: () => 1
- };
- const portalsHandlers = {
- "24horas": horas24,
- "adnradio": adnradio,
- "biobiochile": biobiochile,
- "chilecultura": chilecultura,
- "ciper": ciper,
- "codexverde": codexverde,
- "contrapoder": contrapoder,
- "cooperativa": cooperativa,
- "df": df,
- "elciudadano": elciudadano,
- "eldesconcierto": eldesconcierto,
- "elmostrador": elmostrador,
- "emol": emol,
- "fastcheck": fastcheck,
- // "glaciareschilenos": glaciareschilenos,
- "interferencia": interferencia,
- "laderasur": laderasur,
- "lanacion": lanacion,
- "latercera": latercera,
- "meteored": meteored,
- //"resumen": resumen,
- "tarreo": tarreo,
- "theclinic": theclinic
- };
- const activePortalsHandlers: Array<Handler> = Object.keys(portalsHandlers)
- .filter((portalName) => !config.DEVELOP || config.DEV_ACTIVE_PORTALS.includes(portalName))
- .map((portalName) => portalsHandlers[portalName]);
- const cooldown = 10000; // 10 seconds
- async function main(): Promise<void> {
- console.log(`${activePortalsHandlers}`)
- for (const portalHandler of activePortalsHandlers) {
- await portalHandler(null, context, () => { });
- await new Promise((resolve) => setTimeout(resolve, cooldown));
- }
- }
- main()
- .catch((err) => {
- console.error(err)
- })
- .finally(() => {
- process.exit(0);
- });
|