Skip to content

Commit

Permalink
Remove events
Browse files Browse the repository at this point in the history
This may be causing the SQS to fire a high amount of requests
  • Loading branch information
ruchernchong committed Dec 17, 2023
1 parent 195edda commit 88369c2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 72 deletions.
5 changes: 0 additions & 5 deletions packages/core/src/event.ts

This file was deleted.

29 changes: 0 additions & 29 deletions packages/core/src/todo.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/functions/src/events/todo-created.ts

This file was deleted.

18 changes: 0 additions & 18 deletions packages/functions/src/todo.ts

This file was deleted.

16 changes: 2 additions & 14 deletions stacks/MyStack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config, StackContext, Api, EventBus, Cron } from "sst/constructs";
import { Config, StackContext, Api, Cron } from "sst/constructs";

const CUSTOM_DOMAINS: Record<string, any> = {
dev: {
Expand All @@ -12,19 +12,13 @@ const CUSTOM_DOMAINS: Record<string, any> = {
};

export const api = ({ stack }: StackContext) => {
const bus = new EventBus(stack, "bus", {
defaults: {
retries: 10,
},
});

const MONGODB_URI = new Config.Secret(stack, "MONGODB_URI");

const api = new Api(stack, "api", {
defaults: {
throttle: { burst: 5, rate: 50 },
function: {
bind: [bus, MONGODB_URI],
bind: [MONGODB_URI],
},
},
customDomain: CUSTOM_DOMAINS[stack.stage],
Expand All @@ -35,8 +29,6 @@ export const api = ({ stack }: StackContext) => {
"GET /": "packages/functions/src/car.electric",
"GET /car/electric": "packages/functions/src/car.electric",
"GET /car/petrol": "packages/functions/src/car.petrol",
"GET /todo": "packages/functions/src/todo.list",
"POST /todo": "packages/functions/src/todo.create",
"GET /updater": "packages/functions/src/datasets.updater",
},
});
Expand All @@ -53,10 +45,6 @@ export const api = ({ stack }: StackContext) => {
enabled: stack.stage === "prod",
});

bus.subscribe("todo.created", {
handler: "packages/functions/src/events/todo-created.handler",
});

stack.addOutputs({
ApiEndpoint: api.url,
});
Expand Down

0 comments on commit 88369c2

Please sign in to comment.