fix merge errors
This commit is contained in:
parent
75d41c3959
commit
5d962da61e
8 changed files with 17 additions and 14 deletions
|
|
@ -16,6 +16,7 @@ import type { UsersRepository, NotesRepository, AccessTokensRepository, MiAntenn
|
|||
import { DI } from '@/di-symbols.js';
|
||||
import { AntennaService } from '@/core/AntennaService.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import type { TimeService } from '@/core/TimeService.js';
|
||||
|
||||
export type UpdateInstanceJob = {
|
||||
latestRequestReceivedAt?: Date,
|
||||
|
|
@ -84,6 +85,7 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
private readonly internalEventService: InternalEventService,
|
||||
private readonly antennaService: AntennaService,
|
||||
private readonly cacheService: CacheService,
|
||||
private readonly timeService: TimeService,
|
||||
|
||||
loggerService: LoggerService,
|
||||
) {
|
||||
|
|
@ -94,6 +96,7 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
|
||||
this.updateInstanceQueue = new CollapsedQueue(
|
||||
this.internalEventService,
|
||||
this.timeService,
|
||||
'updateInstance',
|
||||
fiveMinuteInterval,
|
||||
(oldJob, newJob) => ({
|
||||
|
|
@ -170,6 +173,7 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
|
||||
this.updateUserQueue = new CollapsedQueue(
|
||||
this.internalEventService,
|
||||
this.timeService,
|
||||
'updateUser',
|
||||
oneMinuteInterval,
|
||||
(oldJob, newJob) => ({
|
||||
|
|
@ -221,6 +225,7 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
|
||||
this.updateNoteQueue = new CollapsedQueue(
|
||||
this.internalEventService,
|
||||
this.timeService,
|
||||
'updateNote',
|
||||
oneMinuteInterval,
|
||||
(oldJob, newJob) => ({
|
||||
|
|
@ -246,6 +251,7 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
|
||||
this.updateAccessTokenQueue = new CollapsedQueue(
|
||||
this.internalEventService,
|
||||
this.timeService,
|
||||
'updateAccessToken',
|
||||
fiveMinuteInterval,
|
||||
(oldJob, newJob) => ({
|
||||
|
|
@ -266,6 +272,7 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
|
||||
this.updateAntennaQueue = new CollapsedQueue(
|
||||
this.internalEventService,
|
||||
this.timeService,
|
||||
'updateAntenna',
|
||||
fiveMinuteInterval,
|
||||
(oldJob, newJob) => ({
|
||||
|
|
|
|||
|
|
@ -739,7 +739,7 @@ export class DriveService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async deleteFile(file: MiDriveFile, isExpired = false, deleter?: MiUser) {
|
||||
public async deleteFile(file: MiDriveFile, isExpired = false, deleter?: { id: string }) {
|
||||
await this.queueService.createDeleteFileJob(file.id, isExpired, deleter?.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ export class NoteDeleteService {
|
|||
}
|
||||
|
||||
for (const cascade of cascadingNotes) {
|
||||
if (this.userEntityService.isRemoteUser(cascade.user)) {
|
||||
if (isRemoteUser(cascade.user)) {
|
||||
if (!isPureRenote(cascade)) {
|
||||
const i = await this.federatedInstanceService.fetchOrRegister(cascade.user.host);
|
||||
await this.collapsedQueueService.updateInstanceQueue.enqueue(i.id, { notesCountDelta: -1 });
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import type { EmojisRepository, NoteReactionsRepository, UsersRepository, NotesR
|
|||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { isLocalUser, isRemoteUser } from '@/models/User.js';
|
||||
import type { MiRemoteUser, MiUser } from '@/models/User.js';
|
||||
import { isLocalUser, isRemoteUser } from '@/models/User.js';
|
||||
import type { MiNote } from '@/models/Note.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { MiNoteReaction } from '@/models/NoteReaction.js';
|
||||
|
|
@ -228,7 +227,7 @@ export class ReactionService implements OnModuleInit {
|
|||
.execute();
|
||||
}
|
||||
|
||||
await this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: new Date() });
|
||||
await this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: this.timeService.date });
|
||||
|
||||
// 30%の確率、セルフではない、3日以内に投稿されたノートの場合ハイライト用ランキング更新
|
||||
if (
|
||||
|
|
@ -346,7 +345,7 @@ export class ReactionService implements OnModuleInit {
|
|||
.execute();
|
||||
}
|
||||
|
||||
await this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: new Date() });
|
||||
await this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: this.timeService.date });
|
||||
|
||||
this.globalEventService.publishNoteStream(note.id, 'unreacted', {
|
||||
reaction: this.decodeReaction(exist.reaction).reaction,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ export class ApPersonService implements OnModuleInit {
|
|||
private readonly cacheManagementService: CacheManagementService,
|
||||
private readonly utilityService: UtilityService,
|
||||
private readonly apUtilityService: ApUtilityService,
|
||||
private readonly idService: IdService,
|
||||
private readonly timeService: TimeService,
|
||||
private readonly queueService: QueueService,
|
||||
private readonly collapsedQueueService: CollapsedQueueService,
|
||||
|
|
@ -952,7 +951,7 @@ export class ApPersonService implements OnModuleInit {
|
|||
resolver ??= this.apResolverService.createResolver();
|
||||
|
||||
// Mark as updated
|
||||
await this.usersRepository.update({ id: userId }, { lastFetchedFeaturedAt: new Date() });
|
||||
await this.usersRepository.update({ id: userId }, { lastFetchedFeaturedAt: this.timeService.date });
|
||||
await this.internalEventService.emit('remoteUserUpdated', { id: userId });
|
||||
|
||||
// Resolve and regist Notes
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { TimeService, type TimerHandle } from '@/global/TimeService.js';
|
||||
import promiseLimit from 'promise-limit';
|
||||
import type { TimeService, TimerHandle } from '@/global/TimeService.js';
|
||||
import { InternalEventService } from '@/core/InternalEventService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { Serialized } from '@/types.js';
|
||||
|
|
@ -31,7 +31,7 @@ export class CollapsedQueue<V> {
|
|||
private readonly deferredKeys = new Set<string>();
|
||||
|
||||
constructor(
|
||||
private readonly internalEventService: InternalEventervice,
|
||||
private readonly internalEventService: InternalEventService,
|
||||
private readonly timeService: TimeService,
|
||||
public readonly name: string,
|
||||
private readonly timeout: number,
|
||||
|
|
@ -85,7 +85,7 @@ export class CollapsedQueue<V> {
|
|||
const job = this.jobs.get(key);
|
||||
if (!job) return;
|
||||
|
||||
clearTimeout(job.timer);
|
||||
this.timeService.stopTimer(job.timer);
|
||||
this.jobs.delete(key);
|
||||
await this.internalEventService.emit('collapsedQueueDefer', { name: this.name, key, deferred: false });
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ export class CollapsedQueue<V> {
|
|||
@bindThis
|
||||
async performAllNow() {
|
||||
for (const job of this.jobs.values()) {
|
||||
clearTimeout(job.timer);
|
||||
this.timeService.stopTimer(job.timer);
|
||||
}
|
||||
|
||||
const entries = Array.from(this.jobs.entries());
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import { isRemoteUser, isLocalUser } from '@/models/User.js';
|
|||
import type { MiNote } from '@/models/Note.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
|
||||
@Injectable()
|
||||
export class GetterService {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import { MiMeta, MiNote, MiUser, MiUserKeypair, UserNotePiningsRepository, UserP
|
|||
import { DI } from '@/di-symbols.js';
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { DownloadService } from '@/core/DownloadService.js';
|
||||
import { ApUtilityService } from '@/core/activitypub/ApUtilityService.js';
|
||||
import { genAidx } from '@/misc/id/aidx.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { MockResolver } from '../misc/mock-resolver.js';
|
||||
|
|
@ -186,8 +185,8 @@ describe('ActivityPub', () => {
|
|||
cacheManagementService = app.get(CacheManagementService);
|
||||
mockConsole = app.get<MockConsole>(DI.console);
|
||||
notesRepository = app.get<NotesRepository>(DI.notesRepository);
|
||||
});
|
||||
userNotePiningsRepository = app.get<UserNotePiningsRepository>(DI.userNotePiningsRepository);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue