fix(server): リアクションできない問題をとりあえず修正 (#10529)
* fix(server): リアクションできない問題をとりあえず修正 Fix #10502 * Update packages/backend/src/core/CustomEmojiService.ts --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
269d1e72cb
commit
9feb6b0f5b
@ -44,7 +44,10 @@ export class CustomEmojiService {
|
|||||||
memoryCacheLifetime: 1000 * 60 * 3, // 3m
|
memoryCacheLifetime: 1000 * 60 * 3, // 3m
|
||||||
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
|
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
|
||||||
toRedisConverter: (value) => JSON.stringify(value.values()),
|
toRedisConverter: (value) => JSON.stringify(value.values()),
|
||||||
fromRedisConverter: (value) => new Map(JSON.parse(value).map((x: Emoji) => [x.name, x])), // TODO: Date型の変換
|
fromRedisConverter: (value) => {
|
||||||
|
if (!Array.isArray(JSON.parse(value))) return undefined;
|
||||||
|
return new Map(JSON.parse(value).map((x: Emoji) => [x.name, x]));
|
||||||
|
}, // TODO: Date型の変換
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ export class RedisKVCache<T> {
|
|||||||
private memoryCache: MemoryKVCache<T>;
|
private memoryCache: MemoryKVCache<T>;
|
||||||
private fetcher: (key: string) => Promise<T>;
|
private fetcher: (key: string) => Promise<T>;
|
||||||
private toRedisConverter: (value: T) => string;
|
private toRedisConverter: (value: T) => string;
|
||||||
private fromRedisConverter: (value: string) => T;
|
private fromRedisConverter: (value: string) => T | undefined; // undefined means no cache
|
||||||
|
|
||||||
constructor(redisClient: RedisKVCache<T>['redisClient'], name: RedisKVCache<T>['name'], opts: {
|
constructor(redisClient: RedisKVCache<T>['redisClient'], name: RedisKVCache<T>['name'], opts: {
|
||||||
lifetime: RedisKVCache<T>['lifetime'];
|
lifetime: RedisKVCache<T>['lifetime'];
|
||||||
@ -92,7 +92,7 @@ export class RedisSingleCache<T> {
|
|||||||
private memoryCache: MemorySingleCache<T>;
|
private memoryCache: MemorySingleCache<T>;
|
||||||
private fetcher: () => Promise<T>;
|
private fetcher: () => Promise<T>;
|
||||||
private toRedisConverter: (value: T) => string;
|
private toRedisConverter: (value: T) => string;
|
||||||
private fromRedisConverter: (value: string) => T;
|
private fromRedisConverter: (value: string) => T | undefined; // undefined means no cache
|
||||||
|
|
||||||
constructor(redisClient: RedisSingleCache<T>['redisClient'], name: RedisSingleCache<T>['name'], opts: {
|
constructor(redisClient: RedisSingleCache<T>['redisClient'], name: RedisSingleCache<T>['name'], opts: {
|
||||||
lifetime: RedisSingleCache<T>['lifetime'];
|
lifetime: RedisSingleCache<T>['lifetime'];
|
||||||
|
Loading…
Reference in New Issue
Block a user