Skip to content

Commit cb0e439

Browse files
authored
Merge pull request #23 from grassrootseconomics/williamluke4/api-timeout-fix
fix: extend API timeouts and warm caches hourly to prevent /api/data timeouts
2 parents eaf8712 + 417eb2f commit cb0e439

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

config/cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
export const CACHE_KEY = "graph-data-3";
6-
export const CACHE_TTL_SECONDS = 3600 * 6; // 6 hours
6+
export const CACHE_TTL_SECONDS = 3600 * 24; // 24 hours
77

88
// Field reports cache
99
export const REPORTS_CACHE_KEY = "field-reports-1";
@@ -15,7 +15,7 @@ export const POOLS_CACHE_TTL_SECONDS = 3600; // 1 hour
1515

1616
// Globe data cache
1717
export const GLOBE_CACHE_KEY = "globe-data-1";
18-
export const GLOBE_CACHE_TTL_SECONDS = 3600; // 1 hour
18+
export const GLOBE_CACHE_TTL_SECONDS = 3600 * 24; // 24 hours
1919

2020
// SWR configuration
2121
export const SWR_REFRESH_INTERVAL = 5 * 60 * 1000; // 5 minutes

pages/api/cron.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ export default async function handler(
4444
}
4545

4646
export const config = {
47-
maxDuration: 120,
47+
maxDuration: 300,
4848
};

pages/api/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default async function handler(
3636
}
3737

3838
export const config = {
39-
maxDuration: 60,
39+
maxDuration: 300,
4040
api: {
4141
responseLimit: false,
4242
},

pages/api/geo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default async function handler(
3737
}
3838

3939
export const config = {
40-
maxDuration: 60,
40+
maxDuration: 300,
4141
api: {
4242
responseLimit: false,
4343
},

vercel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"crons": [
33
{
44
"path": "/api/cron",
5-
"schedule": "0 */6 * * *"
5+
"schedule": "0 * * * *"
66
}
77
]
88
}

0 commit comments

Comments
 (0)