-
Notifications
You must be signed in to change notification settings - Fork 7
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
new reddit api changes #12
Comments
Well, are you running into any particular issues? By the way, there is no need to explicitly mention the owner of a repo using |
yeah - the stream returns only errors
|
Which version of the library are you using? The provided example works for me as expected. Does it work for you? Please post a minimal, reproducible example of the code that is not working for you. |
0.2.0 of roux-stream and 2.2.7 of roux No it does not work for me - the provided example also has the same issue. It doesn't have an right now this is the rust backtrace
|
The example does include a check for an error value in Again, please a minimal, reproducible example of the code that is not working for you. Otherwise I won't be able to look into this any further. |
here you go - https://github.com/asad-awadia/reproducer
The error check does not actually print the errors so they probably go unnoticed |
I've finally been able to reproduce the issue. The example you provided still was rather complex, in the future please try to provide a minimal example. Here's what I've condensed your code to: use futures_util::*;
use roux_stream::stream_comments;
use std::io;
use std::io::Write;
use std::time::Duration;
use tokio_retry::strategy::ExponentialBackoff;
#[tokio::main]
async fn main() {
let subreddit = roux::subreddit::Subreddit::new("Guitar");
let retry_strategy = ExponentialBackoff::from_millis(5).factor(100).take(3);
let (mut stream, join_handle) = stream_comments(
&subreddit,
Duration::from_secs(2),
retry_strategy,
Some(Duration::from_secs(30)),
);
while let Some(comment) = stream.next().await {
if comment.is_err() {
panic!("{}", comment.err().unwrap().to_string())
}
print!(".");
io::stdout().flush().unwrap();
}
join_handle.await.unwrap().unwrap();
} Running $ RUST_BACKTRACE=full cargo run results in
Unfortunately, that backtrace isn't too helpful -- it doesn't really point us to where things go wrong. Following the calls "manually", we see that the issue is the decoding of the API response requesting the latest comments. The API URL for that is
So you're running into rate limiting. In your original example, this is probably due to querying multiple subreddits "at once". In my condensed version, I've reduced the wait period between pulls to achieve a similar effect. The Reddit API rules say the following about rate limits:
Since your code does not use OAuth, you have 10 QPM, which the code violates -- so you're getting a HTTP 429 after the documented 10 minutes window. You will need to switch to OAuth or use a longer delay between polls. Unfortunately, neither you as a user of As there is nothing else to do w.r.t. |
with the new reddit api changes is this still working as expected?
The text was updated successfully, but these errors were encountered: