Update StatusHashtagService

This commit is contained in:
Daniel Supernault 2019-07-02 00:34:28 -06:00
parent 58a19bbf05
commit 8a47b03a1b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -18,10 +18,15 @@ class StatusHashtagService {
$res = collect([]);
$key = self::CACHE_KEY . $id;
$stop = $stop > 2000 ? 2000 : $stop;
$ids = Redis::zrangebyscore($key, $start, $stop);
$ids = Redis::zrevrangebyscore($key, $start, $stop);
if(empty($ids)) {
if(self::count($id) == 0) {
$ids = self::coldGet($id, 0, 2000);
$ids = $ids->splice($start, $stop);
} else {
$ids = self::coldGet($id, $start, $stop);
}
}
foreach($ids as $statusId) {
$res->push(self::getStatus($statusId, $id));
}