merge: Reduce log spam from `ApPersonService.updateFeatured` (!747)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/747 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Tess K <me@thvxl.se>
This commit is contained in:
commit
9f3b97effb
|
@ -7,6 +7,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import promiseLimit from 'promise-limit';
|
import promiseLimit from 'promise-limit';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import { ModuleRef } from '@nestjs/core';
|
import { ModuleRef } from '@nestjs/core';
|
||||||
|
import { AbortError } from 'node-fetch';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { FollowingsRepository, InstancesRepository, MiMeta, UserProfilesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js';
|
import type { FollowingsRepository, InstancesRepository, MiMeta, UserProfilesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
|
@ -722,7 +723,15 @@ export class ApPersonService implements OnModuleInit {
|
||||||
const _resolver = resolver ?? this.apResolverService.createResolver();
|
const _resolver = resolver ?? this.apResolverService.createResolver();
|
||||||
|
|
||||||
// Resolve to (Ordered)Collection Object
|
// Resolve to (Ordered)Collection Object
|
||||||
const collection = await _resolver.resolveCollection(user.featured);
|
const collection = await _resolver.resolveCollection(user.featured).catch(err => {
|
||||||
|
if (err instanceof AbortError || err instanceof StatusError) {
|
||||||
|
this.logger.warn(`Failed to update featured notes: ${err.name}: ${err.message}`);
|
||||||
|
} else {
|
||||||
|
this.logger.error('Failed to update featured notes:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!collection) return;
|
||||||
|
|
||||||
if (!isCollectionOrOrderedCollection(collection)) throw new Error('Object is not Collection or OrderedCollection');
|
if (!isCollectionOrOrderedCollection(collection)) throw new Error('Object is not Collection or OrderedCollection');
|
||||||
|
|
||||||
// Resolve to Object(may be Note) arrays
|
// Resolve to Object(may be Note) arrays
|
||||||
|
|
Loading…
Reference in New Issue