Compare commits

...

5 Commits

Author SHA1 Message Date
pen
c5d475ff1c
Merge bb1a8020d7 into 3c81926f71 2024-12-22 13:24:25 +00:00
pen
bb1a8020d7
Merge branch 'develop' into branch 2024-12-22 22:24:23 +09:00
かっこかり
3c81926f71
fix(frontend): serverContextの値を利用する条件が間違っていたのを修正 (#15166)
Some checks are pending
Check SPDX-License-Identifier / check-spdx-license-id (push) Waiting to run
Check copyright year / check_copyright_year (push) Waiting to run
Publish Docker image (develop) / Build (linux/amd64) (push) Waiting to run
Publish Docker image (develop) / Build (linux/arm64) (push) Waiting to run
Publish Docker image (develop) / merge (push) Blocked by required conditions
Dockle / dockle (push) Waiting to run
Lint / pnpm_install (push) Waiting to run
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Storybook / build (push) Waiting to run
Test (frontend) / vitest (22.11.0) (push) Waiting to run
Test (frontend) / e2e (chrome, 22.11.0) (push) Waiting to run
Test (production install and build) / production (22.11.0) (push) Waiting to run
2024-12-22 13:36:17 +09:00
pen
e09ecac7bb
del log 2024-12-01 03:59:21 +09:00
pen
98366d1ed5 purgeFTT 2024-11-30 18:45:45 +00:00
5 changed files with 38 additions and 6 deletions

View File

@ -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();
}
}

View File

@ -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, {

View File

@ -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,

View File

@ -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;

View File

@ -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;