Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommentStream appears to drop a significant amount of comments from /r/all. #47

Closed
Orbyt opened this issue Nov 11, 2020 · 2 comments
Closed
Assignees

Comments

@Orbyt
Copy link

Orbyt commented Nov 11, 2020

When listening for comments on /r/all, CommentStream appears to drop a significant number of comments when compared to comment streams created by accessing the Reddit API via other means. I created two simple scripts, one in Node.js utilizing Snoostorm, and one in Python using the very popular PRAW module. Both scripts listened for comments on /r/all and printed comment IDs to a file.

The results from PRAW surfaced a very large number of comments that were not present in the results from the script utilizing Snoostorm.

const r = new Snoowrap({
    userAgent: 'reddit-bot-example-node',
    clientId: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
    username: REDDIT_USER,
    password: REDDIT_PASS
});

const stream = new CommentStream(r, { subreddit: "all"});
stream.on("item", comment => {
    fs.appendFile('results.txt', comment.id + " " + comment.permalink +"\n", function (err) {
        if (err) throw err;
        console.log('Saved!');
    });
})
@Orbyt
Copy link
Author

Orbyt commented Nov 11, 2020

Explicitly specifying a limit of 100 via CommentStream(r, { subreddit: "all", limit: 100, pollTime: 2000,}) appears to return a number of comments similar to the number of comments returned when using other methods.

@brenapp brenapp self-assigned this Nov 13, 2020
@brenapp
Copy link
Owner

brenapp commented Nov 13, 2020

The current default options for new comment streams are as follows

export const DefaultOptions: SnooStormOptions = {
  pollTime: 2000,
  limit: 5,
  subreddit: "all",
};

This is mostly a remnant from the old API limits. The new API limits (when connected via Oath2) support up to 60 requests per minute, and each comment returned counted as a ratelimit (if I'm remembering correctly, I wrote that code years ago). Therefore, Snoostorm is designed to have up to 2 simultaneous streams running without issue.

However, because the API ratelimit has changed, it makes sense to up the default. This should be updated in the next patch version.

brenapp added a commit that referenced this issue Nov 13, 2020
@brenapp brenapp closed this as completed Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants