mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-28 17:23:17 +00:00
Update ApiV1Controller, fix empty public timeline bug
This commit is contained in:
parent
00c32360ae
commit
0584f9ee95
2 changed files with 9 additions and 7 deletions
|
@ -1486,9 +1486,11 @@ class ApiV1Controller extends Controller
|
|||
$limit = $request->input('limit') ?? 3;
|
||||
$user = $request->user();
|
||||
|
||||
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,11 +48,11 @@ class PublicTimelineService {
|
|||
|
||||
public static function add($val)
|
||||
{
|
||||
return;
|
||||
|
||||
if(config('database.redis.client') === 'phpredis' && self::count() > 400) {
|
||||
if(self::count() > 400) {
|
||||
if(config('database.redis.client') === 'phpredis') {
|
||||
Redis::zpopmin(self::CACHE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
return Redis::zadd(self::CACHE_KEY, $val, $val);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue