From 96f31a0041fbf8b57048905b06fa8ee4a97cd111 Mon Sep 17 00:00:00 2001 From: YUNOCHI Date: Fri, 1 Dec 2023 00:09:31 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Remote=20Avatar=20=EB=8D=B0=EC=BD=94?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98=EC=9A=A9=20=EC=BA=90=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- packages/backend/src/core/AvatarDecorationService.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 92edb1ab07df..198e4cdc8fd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2023.11.1+munochi.4", + "version": "2023.11.1+munochi.5", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/src/core/AvatarDecorationService.ts b/packages/backend/src/core/AvatarDecorationService.ts index b7b7e8104ff1..28b1971f70eb 100644 --- a/packages/backend/src/core/AvatarDecorationService.ts +++ b/packages/backend/src/core/AvatarDecorationService.ts @@ -21,6 +21,7 @@ import {IsNull} from "typeorm"; @Injectable() export class AvatarDecorationService implements OnApplicationShutdown { public cache: MemorySingleCache; + public cacheWithRemote: MemorySingleCache; constructor( @Inject(DI.config) @@ -44,6 +45,7 @@ export class AvatarDecorationService implements OnApplicationShutdown { private httpRequestService: HttpRequestService, ) { this.cache = new MemorySingleCache(1000 * 60 * 30); + this.cacheWithRemote = new MemorySingleCache(1000 * 60 * 30); this.redisForSub.on('message', this.onMessage); } @@ -177,8 +179,10 @@ export class AvatarDecorationService implements OnApplicationShutdown { }; if (existingDecoration == null) { await this.create(decorationData); + this.cacheWithRemote.delete(); } else { await this.update(existingDecoration.id, decorationData); + this.cacheWithRemote.delete(); } const findDecoration = await this.avatarDecorationsRepository.findOneBy({ host: userHost, @@ -212,11 +216,12 @@ export class AvatarDecorationService implements OnApplicationShutdown { public async getAll(noCache = false, withRemote = false): Promise { if (noCache) { this.cache.delete(); + this.cacheWithRemote.delete(); } if (!withRemote) { return this.cache.fetch(() => this.avatarDecorationsRepository.find({ where: { host: IsNull() } })); } else { - return this.cache.fetch(() => this.avatarDecorationsRepository.find()); + return this.cacheWithRemote.fetch(() => this.avatarDecorationsRepository.find()); } } From 0c85ada7b5eaecf69e8beb36c2befc0d87844929 Mon Sep 17 00:00:00 2001 From: Yunochi Date: Fri, 1 Dec 2023 09:57:20 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Revert=20"=EB=A6=AC=EB=AA=A8=ED=8A=B8=20?= =?UTF-8?q?=EC=95=84=EB=B0=94=ED=83=80=20=EC=BA=90=EC=8B=9C=20=EC=9E=84?= =?UTF-8?q?=EC=8B=9C=ED=8C=A8=EC=B9=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d3cbfb079bace3d827846d4b8409b5cb9278d613. --- packages/backend/src/core/entities/UserEntityService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 3d3be807394f..2350c4715676 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -358,7 +358,7 @@ export class UserEntityService implements OnModuleInit { host: user.host, avatarUrl: user.avatarUrl ?? this.getIdenticonUrl(user), avatarBlurhash: user.avatarBlurhash, - avatarDecorations: user.avatarDecorations.length > 0 ? this.avatarDecorationService.getAll(true, true).then(decorations => user.avatarDecorations.filter(ud => decorations.some(d => d.id === ud.id)).map(ud => ({ + avatarDecorations: user.avatarDecorations.length > 0 ? this.avatarDecorationService.getAll(false, true).then(decorations => user.avatarDecorations.filter(ud => decorations.some(d => d.id === ud.id)).map(ud => ({ id: ud.id, angle: ud.angle || undefined, flipH: ud.flipH || undefined,