(event: SQSEvent)
| 23 | import { disposable } from "@console/core/util/disposable"; |
| 24 | |
| 25 | export async function handler(event: SQSEvent) { |
| 26 | console.log("got", event.Records.length, "records"); |
| 27 | for (const record of event.Records) { |
| 28 | const evt = JSON.parse(record.body); |
| 29 | console.log(record.body); |
| 30 | await withActor( |
| 31 | { |
| 32 | type: "system", |
| 33 | properties: { |
| 34 | workspaceID: evt.workspaceID, |
| 35 | }, |
| 36 | }, |
| 37 | async () => { |
| 38 | if (evt.price === "invocations") { |
| 39 | await processInvocations(evt.stageID); |
| 40 | } else if (evt.price === "resources") { |
| 41 | await processResources(evt.workspaceID); |
| 42 | } |
| 43 | }, |
| 44 | ); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | async function processInvocations(stageID: string) { |
| 49 | const stage = await Stage.fromID(stageID); |
nothing calls this directly
no test coverage detected