Skip to content

Commit

Permalink
Merge pull request pixelfed#1694 from pixelfed/staging
Browse files Browse the repository at this point in the history
Update StatusHashtagService, fix count bug
  • Loading branch information
dansup authored Sep 11, 2019
2 parents 7dc27a5 + 59aae79 commit 19a78a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.3...dev)

### Added
-

### Fixed
-
- Fixed count bug in StatusHashtagService [#1694]((https://github.com/pixelfed/pixelfed/pull/1694)

### Changed
- 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)
Expand Down
10 changes: 5 additions & 5 deletions app/Services/StatusHashtagService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public static function del($key)

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

public static function getStatus($statusId, $hashtagId)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"plyr": "^3.5.6",
"promise-polyfill": "8.1.0",
"pusher-js": "^4.4.0",
"quill": "^1.3.6",
"quill": "^1.3.7",
"readmore-js": "^2.2.1",
"socket.io-client": "^2.2.0",
"sweetalert": "^2.1.2",
Expand Down

0 comments on commit 19a78a4

Please sign in to comment.