Merge pull request #1694 from pixelfed/staging

Update StatusHashtagService, fix count bug
This commit is contained in:
daniel 2019-09-10 22:10:32 -06:00 committed by GitHub
commit 19a78a46f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -3,13 +3,13 @@
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.3...dev) ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.3...dev)
### Added ### Added
-
### Fixed ### Fixed
- - Fixed count bug in StatusHashtagService [#1694]((https://github.com/pixelfed/pixelfed/pull/1694)
### Changed ### Changed
- Updated EmailService, added new domains [#1690](https://github.com/pixelfed/pixelfed/pull/1690) - Updated EmailService, added new domains [#1690](https://github.com/pixelfed/pixelfed/pull/1690)
- Updated quill.js to v1.3.7 [#1692](https://github.com/pixelfed/pixelfed/pull/1690)
## [v0.10.3 (2019-09-08)](https://github.com/pixelfed/pixelfed/compare/v0.10.2...v0.10.3) ## [v0.10.3 (2019-09-08)](https://github.com/pixelfed/pixelfed/compare/v0.10.2...v0.10.3)

View File

@ -56,11 +56,11 @@ class StatusHashtagService {
public static function count($id) public static function count($id)
{ {
$count = Redis::zcount(self::CACHE_KEY . $id, '-inf', '+inf'); $key = 'pf:services:status-hashtag:count:' . $id;
if(empty($count)) { $ttl = now()->addHours(6);
$count = StatusHashtag::whereHashtagId($id)->count(); return Cache::remember($key, $ttl, function() use($id) {
} return StatusHashtag::whereHashtagId($id)->count();
return $count; });
} }
public static function getStatus($statusId, $hashtagId) public static function getStatus($statusId, $hashtagId)

View File

@ -40,7 +40,7 @@
"plyr": "^3.5.6", "plyr": "^3.5.6",
"promise-polyfill": "8.1.0", "promise-polyfill": "8.1.0",
"pusher-js": "^4.4.0", "pusher-js": "^4.4.0",
"quill": "^1.3.6", "quill": "^1.3.7",
"readmore-js": "^2.2.1", "readmore-js": "^2.2.1",
"socket.io-client": "^2.2.0", "socket.io-client": "^2.2.0",
"sweetalert": "^2.1.2", "sweetalert": "^2.1.2",