mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-05 19:46:57 +00:00
reduce log spam from UrlPreviewService.ts
This commit is contained in:
parent
163be8d4a4
commit
c23b1c3be7
1 changed files with 2 additions and 7 deletions
|
@ -125,7 +125,6 @@ export class UrlPreviewService {
|
|||
const cacheKey = `${url}@${lang}@${cacheFormatVersion}`;
|
||||
const cached = await this.previewCache.get(cacheKey);
|
||||
if (cached !== undefined) {
|
||||
this.logger.info(`Returning cache preview of ${cacheKey}`);
|
||||
// Cache 1 day (matching redis)
|
||||
reply.header('Cache-Control', 'public, max-age=86400');
|
||||
|
||||
|
@ -136,10 +135,6 @@ export class UrlPreviewService {
|
|||
return cached;
|
||||
}
|
||||
|
||||
this.logger.info(this.meta.urlPreviewSummaryProxyUrl
|
||||
? `(Proxy) Getting preview of ${cacheKey} ...`
|
||||
: `Getting preview of ${cacheKey} ...`);
|
||||
|
||||
try {
|
||||
const summary: LocalSummalyResult = this.meta.urlPreviewSummaryProxyUrl
|
||||
? await this.fetchSummaryFromProxy(url, this.meta, lang)
|
||||
|
@ -157,7 +152,7 @@ export class UrlPreviewService {
|
|||
};
|
||||
}
|
||||
|
||||
this.logger.succ(`Got preview of ${url}: ${summary.title}`);
|
||||
this.logger.info(`Got preview of ${url} in ${lang}: ${summary.title}`);
|
||||
|
||||
if (!(summary.url.startsWith('http://') || summary.url.startsWith('https://'))) {
|
||||
throw new Error('unsupported schema included');
|
||||
|
@ -184,7 +179,7 @@ export class UrlPreviewService {
|
|||
|
||||
return summary;
|
||||
} catch (err) {
|
||||
this.logger.warn(`Failed to get preview of ${url}: ${err}`);
|
||||
this.logger.warn(`Failed to get preview of ${url} for ${lang}: ${err}`);
|
||||
|
||||
reply.code(422);
|
||||
reply.header('Cache-Control', 'max-age=86400, immutable');
|
||||
|
|
Loading…
Add table
Reference in a new issue