This commit is contained in:
tamaina 2025-07-14 14:15:29 +09:00
parent 3a5870b9a5
commit cbc85eef3e
1 changed files with 14 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import * as Redis from 'ioredis';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
import { IdService } from '@/core/IdService.js';
import { MiUser } from '@/models/User.js';
export type FanoutTimelineName = (
// home timeline
@ -112,4 +113,17 @@ export class FanoutTimelineService {
public purge(name: FanoutTimelineName) {
return this.redisForTimelines.del('list:' + name);
}
@bindThis
public purgeByUserIds(userIds: MiUser['id'][]) {
return Promise.all(userIds.flatMap(userId => [
this.purge(`homeTimeline:${userId}`),
this.purge(`homeTimelineWithFiles:${userId}`),
this.purge(`localTimelineWithReplyTo:${userId}`),
this.purge(`userTimeline:${userId}`),
this.purge(`userTimelineWithFiles:${userId}`),
this.purge(`userTimelineWithReplies:${userId}`),
this.purge(`userTimelineWithChannel:${userId}`),
]));
}
}