Skip to content

Commit 241a015

Browse files
TaniWanKenobiclaude
andcommitted
Fix unhandled cache-write rejection; finish events->programs cleanup
Catching the Upstash set() rejection in middleware/cache.js prevents intermittent crashes on warm serverless instances. Also tidies package.json/README leftovers from the events->programs rename. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8ad6c29 commit 241a015

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public/ # Static frontend demo
8484
controllers/ # Route handler logic
8585
routes/ # Express route definitions
8686
middleware/
87-
auth.js # x-api-key validation
8887
cache.js # Upstash Redis cache
8988
server.js # App entrypoint
9089
```

middleware/cache.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ const cache = (duration) => {
3030
const originalJson = res.json.bind(res);
3131
res.json = (data) => {
3232
if (data.success) {
33-
client.set(key, data, { ex: duration });
33+
client.set(key, data, { ex: duration }).catch((err) => {
34+
console.error('Cache write failed:', err);
35+
});
3436
}
3537
originalJson(data);
3638
};

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ysws-events-api",
33
"version": "1.0.0",
4-
"description": "API for YSWS and Hack Club events",
4+
"description": "Public read-only API for Hack Club's YSWS programs",
55
"main": "server.js",
66
"scripts": {
77
"start": "node server.js",
@@ -10,13 +10,12 @@
1010
"keywords": [
1111
"hackclub",
1212
"ysws",
13-
"events",
13+
"programs",
1414
"api"
1515
],
1616
"author": "",
1717
"license": "MIT",
1818
"dependencies": {
19-
"@slack/webhook": "^7.0.7",
2019
"@upstash/redis": "^1.36.3",
2120
"airtable": "^0.12.2",
2221
"cors": "^2.8.6",

0 commit comments

Comments
 (0)