mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-13 21:40:45 +01:00
revert: trending support for redis 6.3
It seems this change has caused redis to periodically crash on big instances
This commit is contained in:
parent
49e3a31bba
commit
fd51854670
2 changed files with 13 additions and 29 deletions
|
@ -35,16 +35,10 @@ export class FeaturedService {
|
||||||
`${name}:${currentWindow}`,
|
`${name}:${currentWindow}`,
|
||||||
score,
|
score,
|
||||||
element);
|
element);
|
||||||
|
redisTransaction.expire(
|
||||||
const TTL = await this.redisClient.ttl(`${name}:${currentWindow}`);
|
`${name}:${currentWindow}`,
|
||||||
|
(windowRange * 3) / 1000,
|
||||||
if (TTL === -1) {
|
'NX'); // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
||||||
this.redisClient.expire(`${name}:${currentWindow}`,
|
|
||||||
(windowRange * 3) / 1000, // 1時間
|
|
||||||
//'NX', // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await redisTransaction.exec();
|
await redisTransaction.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,30 +176,20 @@ export class HashtagService {
|
||||||
|
|
||||||
// チャート用
|
// チャート用
|
||||||
redisPipeline.pfadd(`hashtagUsers:${hashtag}:${window}`, userId);
|
redisPipeline.pfadd(`hashtagUsers:${hashtag}:${window}`, userId);
|
||||||
|
redisPipeline.expire(`hashtagUsers:${hashtag}:${window}`,
|
||||||
|
60 * 60 * 24 * 3, // 3日間
|
||||||
|
'NX', // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
||||||
|
);
|
||||||
|
|
||||||
// ユニークカウント用
|
// ユニークカウント用
|
||||||
// TODO: Bloom Filter を使うようにしても良さそう
|
// TODO: Bloom Filter を使うようにしても良さそう
|
||||||
redisPipeline.sadd(`hashtagUsers:${hashtag}`, userId);
|
redisPipeline.sadd(`hashtagUsers:${hashtag}`, userId);
|
||||||
|
redisPipeline.expire(`hashtagUsers:${hashtag}`,
|
||||||
|
60 * 60, // 1時間
|
||||||
|
'NX', // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
||||||
|
);
|
||||||
|
|
||||||
await redisPipeline.exec();
|
redisPipeline.exec();
|
||||||
|
|
||||||
const TTL = await this.redisClient.ttl(`hashtagUsers:${hashtag}`);
|
|
||||||
|
|
||||||
if (TTL === -1) {
|
|
||||||
this.redisClient.expire(`hashtagUsers:${hashtag}`,
|
|
||||||
60 * 60, // 1時間
|
|
||||||
//'NX', // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const TTLwindow = await this.redisClient.ttl(`hashtagUsers:${hashtag}:${window}`);
|
|
||||||
|
|
||||||
if (TTLwindow === -1) {
|
|
||||||
this.redisClient.expire(`hashtagUsers:${hashtag}:${window}`,
|
|
||||||
60 * 60 * 24 * 3, // 3日間
|
|
||||||
//'NX', // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
Loading…
Reference in a new issue