Update ApiV1Controller, fix empty public timeline bug

pull/2919/head
Daniel Supernault 4 years ago
parent 00c32360ae
commit 0584f9ee95
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -1486,9 +1486,11 @@ class ApiV1Controller extends Controller
$limit = $request->input('limit') ?? 3;
$user = $request->user();
if(PublicTimelineService::count() == 0) {
PublicTimelineService::warmCache(true, 400);
}
Cache::remember('api:v1:timelines:public:cache_check', 3600, function() {
if(PublicTimelineService::count() == 0) {
PublicTimelineService::warmCache(true, 400);
}
});
if ($max) {
$feed = PublicTimelineService::getRankedMaxId($max, $limit);

@ -48,10 +48,10 @@ class PublicTimelineService {
public static function add($val)
{
return;
if(config('database.redis.client') === 'phpredis' && self::count() > 400) {
Redis::zpopmin(self::CACHE_KEY);
if(self::count() > 400) {
if(config('database.redis.client') === 'phpredis') {
Redis::zpopmin(self::CACHE_KEY);
}
}
return Redis::zadd(self::CACHE_KEY, $val, $val);

Loading…
Cancel
Save