Skip to content

Commit

Permalink
Revert "feat: improve tl performance (misskey-dev#11946)"
Browse files Browse the repository at this point in the history
This reverts commit 6277a55.
  • Loading branch information
GrapeApple0 committed Oct 6, 2023
1 parent ef81b65 commit 9d9ea48
Show file tree
Hide file tree
Showing 84 changed files with 957 additions and 2,179 deletions.
8 changes: 0 additions & 8 deletions .config/docker_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ redis:
# #prefix: example-prefix
# #db: 1

#redisForTimelines:
# host: redis
# port: 6379
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
# #pass: example-pass
# #prefix: example-prefix
# #db: 1

# ┌───────────────────────────┐
#───┘ MeiliSearch configuration └─────────────────────────────

Expand Down
10 changes: 0 additions & 10 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ redis:
# # You can specify more ioredis options...
# #username: example-username

#redisForTimelines:
# host: localhost
# port: 6379
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
# #pass: example-pass
# #prefix: example-prefix
# #db: 1
# # You can specify more ioredis options...
# #username: example-username

# ┌───────────────────────────┐
#───┘ MeiliSearch configuration └─────────────────────────────

Expand Down
8 changes: 0 additions & 8 deletions .devcontainer/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ redis:
# #prefix: example-prefix
# #db: 1

#redisForTimelines:
# host: redis
# port: 6379
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
# #pass: example-pass
# #prefix: example-prefix
# #db: 1

# ┌───────────────────────────┐
#───┘ MeiliSearch configuration └─────────────────────────────

Expand Down
18 changes: 1 addition & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,13 @@
- 投稿画面の改善
- 登録不可なメールアドレスを個別に設定できるように
- 編集履歴を見れるように
- TLのPush型を(一時的に)Revert
## 2023.10.0
### NOTE
- muted_noteテーブルは使われなくなったため手動で削除を行ってください。
- 2023.9.2で導入されたノート編集機能はクオリティの高い実装が困難であることが判明したため撤回されました

### Changes
- API: users/notes, notes/local-timeline で fileType 指定はできなくなりました
- API: notes/global-timeline は現在常に `[]` を返します

### General
- Feat: ユーザーごとに他ユーザーへの返信をタイムラインに含めるか設定可能になりました
- Feat: ユーザーリスト内のメンバーごとに他ユーザーへの返信をユーザーリストタイムラインに含めるか設定可能になりました
- Enhance: ソフトワードミュートとハードワードミュートは統合されました
- Enhance: モデレーションログ機能の強化
- Enhance: ローカリゼーションの更新

### Client
- Enhance: 二要素認証のバックアップコード一覧をテキストファイルでダウンロード可能に
- Fix: リアクションしたユーザ一覧のUIが稀に左上に残ってしまう不具合を修正

### Server
- Enhance: タイムライン取得時のパフォーマンスを改善

## 2023.9.3
### General
- Enhance: ノートの翻訳機能の利用可否をロールで設定可能に
Expand Down
8 changes: 0 additions & 8 deletions chart/files/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ redis:
# #prefix: example-prefix
# #db: 1

#redisForTimelines:
# host: redis
# port: 6379
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
# #pass: example-pass
# #prefix: example-prefix
# #db: 1

# ┌───────────────────────────┐
#───┘ MeiliSearch configuration └─────────────────────────────

Expand Down
8 changes: 5 additions & 3 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1132,9 +1132,6 @@ export interface Locale {
"notificationRecieveConfig": string;
"mutualFollow": string;
"fileAttachedOnly": string;
"showRepliesToOthersInTimeline": string;
"hideRepliesToOthersInTimeline": string;
"externalServices": string;
"_announcement": {
"forExistingUsers": string;
"forExistingUsersDescription": string;
Expand Down Expand Up @@ -1724,6 +1721,11 @@ export interface Locale {
"muteWords": string;
"muteWordsDescription": string;
"muteWordsDescription2": string;
"softDescription": string;
"hardDescription": string;
"soft": string;
"hard": string;
"mutedNotes": string;
};
"_instanceMute": {
"instanceMuteDescription": string;
Expand Down
8 changes: 5 additions & 3 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1129,9 +1129,6 @@ edited: "編集済み"
notificationRecieveConfig: "通知の受信設定"
mutualFollow: "相互フォロー"
fileAttachedOnly: "ファイル付きのみ"
showRepliesToOthersInTimeline: "TLに他の人への返信を含める"
hideRepliesToOthersInTimeline: "TLに他の人への返信を含めない"
externalServices: "外部サービス"

_announcement:
forExistingUsers: "既存ユーザーのみ"
Expand Down Expand Up @@ -1641,6 +1638,11 @@ _wordMute:
muteWords: "ミュートするワード"
muteWordsDescription: "スペースで区切るとAND指定になり、改行で区切るとOR指定になります。"
muteWordsDescription2: "キーワードをスラッシュで囲むと正規表現になります。"
softDescription: "指定した条件のノートをタイムラインから隠します。"
hardDescription: "指定した条件のノートをタイムラインに追加しないようにします。追加されなかったノートは、条件を変更しても除外されたままになります。"
soft: "ソフト"
hard: "ハード"
mutedNotes: "ミュートされたノート"

_instanceMute:
instanceMuteDescription: "ミュートしたサーバーのユーザーへの返信を含めて、設定したサーバーの全てのノートとRenoteをミュートします。"
Expand Down
2 changes: 0 additions & 2 deletions packages/backend/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,4 @@ module.exports = {
maxWorkers: 1, // Make it use worker (that can be killed and restarted)
logHeapUsage: true, // To debug when out-of-memory happens on CI
workerIdleMemoryLimit: '1GiB', // Limit the worker to 1GB (GitHub Workflows dies at 2GB)

maxConcurrency: 32,
};
20 changes: 0 additions & 20 deletions packages/backend/migration/1696222183852-withReplies.js

This file was deleted.

11 changes: 0 additions & 11 deletions packages/backend/migration/1696323464251-user-list-membership.js

This file was deleted.

17 changes: 0 additions & 17 deletions packages/backend/migration/1696331570827-hibernation.js

This file was deleted.

14 changes: 2 additions & 12 deletions packages/backend/src/GlobalModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,18 @@ const $redisForSub: Provider = {
inject: [DI.config],
};

const $redisForTimelines: Provider = {
provide: DI.redisForTimelines,
useFactory: (config: Config) => {
return new Redis.Redis(config.redisForTimelines);
},
inject: [DI.config],
};

@Global()
@Module({
imports: [RepositoryModule],
providers: [$config, $db, $meilisearch, $redis, $redisForPub, $redisForSub, $redisForTimelines],
exports: [$config, $db, $meilisearch, $redis, $redisForPub, $redisForSub, $redisForTimelines, RepositoryModule],
providers: [$config, $db, $meilisearch, $redis, $redisForPub, $redisForSub],
exports: [$config, $db, $meilisearch, $redis, $redisForPub, $redisForSub, RepositoryModule],
})
export class GlobalModule implements OnApplicationShutdown {
constructor(
@Inject(DI.db) private db: DataSource,
@Inject(DI.redis) private redisClient: Redis.Redis,
@Inject(DI.redisForPub) private redisForPub: Redis.Redis,
@Inject(DI.redisForSub) private redisForSub: Redis.Redis,
@Inject(DI.redisForTimelines) private redisForTimelines: Redis.Redis,
) {}

public async dispose(): Promise<void> {
Expand All @@ -107,7 +98,6 @@ export class GlobalModule implements OnApplicationShutdown {
this.redisClient.disconnect(),
this.redisForPub.disconnect(),
this.redisForSub.disconnect(),
this.redisForTimelines.disconnect(),
]);
}

Expand Down
3 changes: 0 additions & 3 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type Source = {
redis: RedisOptionsSource;
redisForPubsub?: RedisOptionsSource;
redisForJobQueue?: RedisOptionsSource;
redisForTimelines?: RedisOptionsSource;
meilisearch?: {
host: string;
port: string;
Expand Down Expand Up @@ -162,7 +161,6 @@ export type Config = {
redis: RedisOptions & RedisOptionsSource;
redisForPubsub: RedisOptions & RedisOptionsSource;
redisForJobQueue: RedisOptions & RedisOptionsSource;
redisForTimelines: RedisOptions & RedisOptionsSource;
perChannelMaxNoteCacheCount: number;
perUserNotificationsMaxCount: number;
deactivateAntennaThreshold: number;
Expand Down Expand Up @@ -229,7 +227,6 @@ export function loadConfig(): Config {
redis,
redisForPubsub: config.redisForPubsub ? convertRedisOptions(config.redisForPubsub, host) : redis,
redisForJobQueue: config.redisForJobQueue ? convertRedisOptions(config.redisForJobQueue, host) : redis,
redisForTimelines: config.redisForTimelines ? convertRedisOptions(config.redisForTimelines, host) : redis,
id: config.id,
proxy: config.proxy,
proxySmtp: config.proxySmtp,
Expand Down
30 changes: 15 additions & 15 deletions packages/backend/src/core/AccountMoveService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IsNull, In, MoreThan, Not } from 'typeorm';
import { bindThis } from '@/decorators.js';
import { DI } from '@/di-symbols.js';
import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js';
import type { BlockingsRepository, FollowingsRepository, InstancesRepository, MutingsRepository, UserListMembershipsRepository, UsersRepository } from '@/models/_.js';
import type { BlockingsRepository, FollowingsRepository, InstancesRepository, MutingsRepository, UserListJoiningsRepository, UsersRepository } from '@/models/_.js';
import type { RelationshipJobData, ThinUser } from '@/queue/types.js';

import { IdService } from '@/core/IdService.js';
Expand Down Expand Up @@ -42,8 +42,8 @@ export class AccountMoveService {
@Inject(DI.mutingsRepository)
private mutingsRepository: MutingsRepository,

@Inject(DI.userListMembershipsRepository)
private userListMembershipsRepository: UserListMembershipsRepository,
@Inject(DI.userListJoiningsRepository)
private userListJoiningsRepository: UserListJoiningsRepository,

@Inject(DI.instancesRepository)
private instancesRepository: InstancesRepository,
Expand Down Expand Up @@ -215,40 +215,40 @@ export class AccountMoveService {
@bindThis
public async updateLists(src: ThinUser, dst: MiUser): Promise<void> {
// Return if there is no list to be updated.
const oldMemberships = await this.userListMembershipsRepository.find({
const oldJoinings = await this.userListJoiningsRepository.find({
where: {
userId: src.id,
},
});
if (oldMemberships.length === 0) return;
if (oldJoinings.length === 0) return;

const existingUserListIds = await this.userListMembershipsRepository.find({
const existingUserListIds = await this.userListJoiningsRepository.find({
where: {
userId: dst.id,
},
}).then(memberships => memberships.map(membership => membership.userListId));
}).then(joinings => joinings.map(joining => joining.userListId));

const newMemberships: Map<string, { createdAt: Date; userId: string; userListId: string; }> = new Map();
const newJoinings: Map<string, { createdAt: Date; userId: string; userListId: string; }> = new Map();

// 重複しないようにIDを生成
const genId = (): string => {
let id: string;
do {
id = this.idService.genId();
} while (newMemberships.has(id));
} while (newJoinings.has(id));
return id;
};
for (const membership of oldMemberships) {
if (existingUserListIds.includes(membership.userListId)) continue; // skip if dst exists in this user's list
newMemberships.set(genId(), {
for (const joining of oldJoinings) {
if (existingUserListIds.includes(joining.userListId)) continue; // skip if dst exists in this user's list
newJoinings.set(genId(), {
createdAt: new Date(),
userId: dst.id,
userListId: membership.userListId,
userListId: joining.userListId,
});
}

const arrayToInsert = Array.from(newMemberships.entries()).map(entry => ({ ...entry[1], id: entry[0] }));
await this.userListMembershipsRepository.insert(arrayToInsert);
const arrayToInsert = Array.from(newJoinings.entries()).map(entry => ({ ...entry[1], id: entry[0] }));
await this.userListJoiningsRepository.insert(arrayToInsert);

// Have the proxy account follow the new account in the same way as UserListService.push
if (this.userEntityService.isRemoteUser(dst)) {
Expand Down
14 changes: 7 additions & 7 deletions packages/backend/src/core/AntennaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { GlobalEventService } from '@/core/GlobalEventService.js';
import * as Acct from '@/misc/acct.js';
import type { Packed } from '@/misc/json-schema.js';
import { DI } from '@/di-symbols.js';
import type { AntennasRepository, UserListMembershipsRepository } from '@/models/_.js';
import type { AntennasRepository, UserListJoiningsRepository } from '@/models/_.js';
import { UtilityService } from '@/core/UtilityService.js';
import { bindThis } from '@/decorators.js';
import type { GlobalEvents } from '@/core/GlobalEventService.js';
Expand All @@ -24,17 +24,17 @@ export class AntennaService implements OnApplicationShutdown {
private antennas: MiAntenna[];

constructor(
@Inject(DI.redisForTimelines)
private redisForTimelines: Redis.Redis,
@Inject(DI.redis)
private redisClient: Redis.Redis,

@Inject(DI.redisForSub)
private redisForSub: Redis.Redis,

@Inject(DI.antennasRepository)
private antennasRepository: AntennasRepository,

@Inject(DI.userListMembershipsRepository)
private userListMembershipsRepository: UserListMembershipsRepository,
@Inject(DI.userListJoiningsRepository)
private userListJoiningsRepository: UserListJoiningsRepository,

private utilityService: UtilityService,
private globalEventService: GlobalEventService,
Expand Down Expand Up @@ -81,7 +81,7 @@ export class AntennaService implements OnApplicationShutdown {
const antennasWithMatchResult = await Promise.all(antennas.map(antenna => this.checkHitAntenna(antenna, note, noteUser).then(hit => [antenna, hit] as const)));
const matchedAntennas = antennasWithMatchResult.filter(([, hit]) => hit).map(([antenna]) => antenna);

const redisPipeline = this.redisForTimelines.pipeline();
const redisPipeline = this.redisClient.pipeline();

for (const antenna of matchedAntennas) {
redisPipeline.xadd(
Expand All @@ -108,7 +108,7 @@ export class AntennaService implements OnApplicationShutdown {
if (antenna.src === 'home') {
// TODO
} else if (antenna.src === 'list') {
const listUsers = (await this.userListMembershipsRepository.findBy({
const listUsers = (await this.userListJoiningsRepository.findBy({
userListId: antenna.userListId!,
})).map(x => x.userId);

Expand Down
Loading

0 comments on commit 9d9ea48

Please sign in to comment.