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