diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-05-25 18:42:47 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-05-28 21:31:40 -0400 |
| commit | 4738b14d1ca76c29f71f3665c7a1b7658835404a (patch) | |
| tree | 1c00f2b579d44ba7c2b3a293acd03b2824046b07 /packages/backend/src/core/MetaService.ts | |
| parent | re-analyze all tables affected by new indexes (diff) | |
| download | sharkey-4738b14d1ca76c29f71f3665c7a1b7658835404a.tar.gz sharkey-4738b14d1ca76c29f71f3665c7a1b7658835404a.tar.bz2 sharkey-4738b14d1ca76c29f71f3665c7a1b7658835404a.zip | |
fix TypeORM error from MetaService.fetch
Diffstat (limited to 'packages/backend/src/core/MetaService.ts')
| -rw-r--r-- | packages/backend/src/core/MetaService.ts | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/packages/backend/src/core/MetaService.ts b/packages/backend/src/core/MetaService.ts index b4ccfec4cc..07f82dc23e 100644 --- a/packages/backend/src/core/MetaService.ts +++ b/packages/backend/src/core/MetaService.ts @@ -74,11 +74,13 @@ export class MetaService implements OnApplicationShutdown { if (!noCache && this.cache) return this.cache; // 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する - let meta = await this.metasRepository.findOne({ - order: { + let meta = await this.metasRepository.createQueryBuilder('meta') + .select() + .orderBy({ id: 'DESC', - }, - }); + }) + .limit(1) + .getOne(); if (!meta) { await this.metasRepository.createQueryBuilder('meta') @@ -89,11 +91,13 @@ export class MetaService implements OnApplicationShutdown { .orIgnore() .execute(); - meta = await this.metasRepository.findOneOrFail({ - order: { + meta = await this.metasRepository.createQueryBuilder('meta') + .select() + .orderBy({ id: 'DESC', - }, - }); + }) + .limit(1) + .getOneOrFail(); } this.cache = meta; |