diff --git a/serverless.yml b/serverless.yml index cbe5139..81464d7 100644 --- a/serverless.yml +++ b/serverless.yml @@ -136,7 +136,7 @@ functions: timeout: 900 memorySize: 250 events: - - schedule: cron(2,17,47 * * * ? *) + - schedule: cron(10,25,40 * * * ? *) runAggregateAllAdapters: handler: src/handlers/runAggregateAllAdapters.default timeout: 900 @@ -158,7 +158,7 @@ functions: timeout: 900 memorySize: 1024 events: - - schedule: cron(0 0,12 * * ? *) + - schedule: cron(1 * * * ? *) dailyAggregateAllAdapters: handler: src/handlers/dailyAggregateAllAdapters.default timeout: 900 diff --git a/src/handlers/runAllAdaptersHistorical.ts b/src/handlers/runAllAdaptersHistorical.ts index 7c9fcaf..dfb9c62 100644 --- a/src/handlers/runAllAdaptersHistorical.ts +++ b/src/handlers/runAllAdaptersHistorical.ts @@ -25,22 +25,14 @@ async function invokeLambda(functionName: string, event: any) { const handler = async (_event: any) => { await closeIdleConnections(); const now = Math.floor(Date.now() / 1000); - const oneDayAgo = now - 86400; - const halfDayAgo = now - 43200; - - const timeRanges = [ - { start: oneDayAgo, end: halfDayAgo }, - { start: halfDayAgo, end: now }, - ]; - - for (const timeRange of timeRanges) { - for (const bridge of bridgeNetworks) { - await invokeLambda("llama-bridges-prod-runAdapterFromTo", { - bridgeName: bridge.bridgeDbName, - fromTimestamp: timeRange.start, - toTimestamp: timeRange.end, - }); - } + const oneHourAgo = now - 3600; + + for (const bridge of bridgeNetworks) { + await invokeLambda("llama-bridges-prod-runAdapterFromTo", { + bridgeName: bridge.bridgeDbName, + fromTimestamp: oneHourAgo, + toTimestamp: now, + }); } console.log("Initiated historical runs for all adapters");