match preview cache duration for HTTP and Redis

This commit is contained in:
Hazelnoot 2025-05-05 09:25:38 -04:00
parent 387efac23f
commit 163be8d4a4

View file

@ -126,8 +126,8 @@ export class UrlPreviewService {
const cached = await this.previewCache.get(cacheKey);
if (cached !== undefined) {
this.logger.info(`Returning cache preview of ${cacheKey}`);
// Cache 7days
reply.header('Cache-Control', 'max-age=604800, immutable');
// Cache 1 day (matching redis)
reply.header('Cache-Control', 'public, max-age=86400');
if (cached.activityPub) {
cached.haveNoteLocally = !! await this.apDbResolverService.getNoteFromApId(cached.activityPub);
@ -179,8 +179,8 @@ export class UrlPreviewService {
this.previewCache.set(cacheKey, summary);
// Cache 7days
reply.header('Cache-Control', 'max-age=604800, immutable');
// Cache 1 day (matching redis)
reply.header('Cache-Control', 'public, max-age=86400');
return summary;
} catch (err) {