-
Notifications
You must be signed in to change notification settings - Fork 0
Needs to be changed to account for less than 100 posts/users #4
Copy link
Copy link
Open
Description
Line 58 in c9b94a9
| if len(allPosts) >= 100 { |
Line 63 in c9b94a9
| if len(sortedUsers) >= 100 { |
What if the subreddit is small and contains less than 100 posts or 100 users? Then the relative cache key won't be set...neither will the relative channel. The logic may need to be changed to the following....
if len(allPosts) >= 100 {
allPosts = allPosts[:100]
}
s.resultsCache.Set(s.redditClient.Config.SubReddit+ "#posts", allPosts, cache.NoExpiration)
s.postDataChannel <- allPosts
if len(sortedUsers) >= 100 {
sortedUsers = sortedUsers[:100]
}
s.resultsCache.Set(s.redditClient.Config.SubReddit+ "#users", sortedUsers, cache.NoExpiration)
s.userCountChannel <- sortedUsers
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels