Merge pull request #1212 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2019-04-28 21:05:54 -06:00 committed by GitHub
commit 2288034b8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -75,7 +75,7 @@ class ApiController extends BaseApiController
->whereNull('status')
->whereNull('domain')
->inRandomOrder()
->take(4)
->take(3)
->get()
->map(function($item, $key) {
return [

View file

@ -34,9 +34,14 @@ class SuggestionService {
return self::del($val);
}
public static function count()
{
return Redis::zcount(self::CACHE_KEY, '-inf', '+inf');
}
public static function warmCache($force = false)
{
if(Redis::zcount(self::CACHE_KEY, '-inf', '+inf') == 0 || $force == true) {
if(self::count() == 0 || $force == true) {
$ids = Profile::whereNull('domain')
->whereIsSuggestable(true)
->whereIsPrivate(false)
@ -44,6 +49,8 @@ class SuggestionService {
foreach($ids as $id) {
self::set($id);
}
return 1;
}
return 0;
}
}