MCPcopy Create free account
hub / github.com/anomalyco/console / handler

Function handler

packages/backend/src/function/billing/fetch-usage.ts:25–46  ·  view source on GitHub ↗
(event: SQSEvent)

Source from the content-addressed store, hash-verified

23import { disposable } from "@console/core/util/disposable";
24
25export 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
48async function processInvocations(stageID: string) {
49 const stage = await Stage.fromID(stageID);

Callers

nothing calls this directly

Calls 2

processInvocationsFunction · 0.85
processResourcesFunction · 0.85

Tested by

no test coverage detected