mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-23 00:29:22 +09:00
Compare commits
5 Commits
161f6aa90a
...
c5d475ff1c
Author | SHA1 | Date | |
---|---|---|---|
|
c5d475ff1c | ||
|
bb1a8020d7 | ||
|
3c81926f71 | ||
|
e09ecac7bb | ||
|
98366d1ed5 |
@ -14,9 +14,9 @@ export type FanoutTimelineName =
|
||||
| `homeTimeline:${string}`
|
||||
| `homeTimelineWithFiles:${string}` // only notes with files are included
|
||||
// local timeline
|
||||
| `localTimeline` // replies are not included
|
||||
| `localTimelineWithFiles` // only non-reply notes with files are included
|
||||
| `localTimelineWithReplies` // only replies are included
|
||||
| 'localTimeline' // replies are not included
|
||||
| 'localTimelineWithFiles' // only non-reply notes with files are included
|
||||
| 'localTimelineWithReplies' // only replies are included
|
||||
| `localTimelineWithReplyTo:${string}` // Only replies to specific local user are included. Parameter is reply user id.
|
||||
|
||||
// antenna
|
||||
@ -111,4 +111,33 @@ export class FanoutTimelineService {
|
||||
public purge(name: FanoutTimelineName) {
|
||||
return this.redisForTimelines.del('list:' + name);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async purgeAllcache() {
|
||||
const timeLinePatterns = [
|
||||
'*list:homeTimeline*',
|
||||
'*list:localTimeline*',
|
||||
'*list:antennaTimeline*',
|
||||
'*list:userTimeline*',
|
||||
'*list:userListTimeline*',
|
||||
'*list:channelTimeline*',
|
||||
'*list:roleTimeline*',
|
||||
];
|
||||
let timeLines = [] as string[];
|
||||
|
||||
for (const timeline of timeLinePatterns) {
|
||||
let cursor = '0';
|
||||
do {
|
||||
const scanResult = await this.redisForTimelines.scan(cursor, 'MATCH', timeline, 'COUNT', 300);
|
||||
cursor = scanResult[0];
|
||||
timeLines = timeLines.concat(scanResult[1]);
|
||||
} while (cursor !== '0');
|
||||
}
|
||||
|
||||
const pipeline = this.redisForTimelines.pipeline();
|
||||
for (const timeLine of timeLines) {
|
||||
pipeline.del(`list:${timeLine.split('list:')[1]}`);
|
||||
}
|
||||
await pipeline.exec();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import { FeaturedService } from '@/core/FeaturedService.js';
|
||||
import { FanoutTimelineService } from './FanoutTimelineService.js';
|
||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
@ -28,6 +29,7 @@ export class MetaService implements OnApplicationShutdown {
|
||||
|
||||
private featuredService: FeaturedService,
|
||||
private globalEventService: GlobalEventService,
|
||||
private fanoutTimelineService: FanoutTimelineService,
|
||||
) {
|
||||
//this.onMessage = this.onMessage.bind(this);
|
||||
|
||||
@ -112,6 +114,7 @@ export class MetaService implements OnApplicationShutdown {
|
||||
before = metas[0];
|
||||
|
||||
if (before) {
|
||||
if (before.enableFanoutTimeline === true && data.enableFanoutTimeline === false) this.fanoutTimelineService.purgeAllcache();
|
||||
await transactionalEntityManager.update(MiMeta, before.id, data);
|
||||
|
||||
const metas = await transactionalEntityManager.find(MiMeta, {
|
||||
|
@ -49,7 +49,7 @@ import { genEmbedCode } from '@/scripts/get-embed-code.js';
|
||||
import { assertServerContext, serverContext } from '@/server-context.js';
|
||||
|
||||
// contextは非ログイン状態の情報しかないためログイン時は利用できない
|
||||
const CTX_CLIP = $i && assertServerContext(serverContext, 'clip') ? serverContext.clip : null;
|
||||
const CTX_CLIP = !$i && assertServerContext(serverContext, 'clip') ? serverContext.clip : null;
|
||||
|
||||
const props = defineProps<{
|
||||
clipId: string,
|
||||
|
@ -67,7 +67,7 @@ import { serverContext, assertServerContext } from '@/server-context.js';
|
||||
import { $i } from '@/account.js';
|
||||
|
||||
// contextは非ログイン状態の情報しかないためログイン時は利用できない
|
||||
const CTX_NOTE = $i && assertServerContext(serverContext, 'note') ? serverContext.note : null;
|
||||
const CTX_NOTE = !$i && assertServerContext(serverContext, 'note') ? serverContext.note : null;
|
||||
|
||||
const props = defineProps<{
|
||||
noteId: string;
|
||||
|
@ -54,7 +54,7 @@ const XGallery = defineAsyncComponent(() => import('./gallery.vue'));
|
||||
const XRaw = defineAsyncComponent(() => import('./raw.vue'));
|
||||
|
||||
// contextは非ログイン状態の情報しかないためログイン時は利用できない
|
||||
const CTX_USER = $i && assertServerContext(serverContext, 'user') ? serverContext.user : null;
|
||||
const CTX_USER = !$i && assertServerContext(serverContext, 'user') ? serverContext.user : null;
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
acct: string;
|
||||
|
Loading…
Reference in New Issue
Block a user