fix(oauth): handle case where a rate limit sneaks in
This commit is contained in:
parent
89313f73e6
commit
4e2ec3fbc9
@ -359,8 +359,13 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
|
|||||||
let has_remaining = body.has_remaining();
|
let has_remaining = body.has_remaining();
|
||||||
|
|
||||||
if !has_remaining {
|
if !has_remaining {
|
||||||
|
// Rate limited, so spawn a force_refresh_token()
|
||||||
|
tokio::spawn(force_refresh_token());
|
||||||
return match reset {
|
return match reset {
|
||||||
Some(val) => Err(format!("Reddit rate limit exceeded. Will reset in: {val}")),
|
Some(val) => Err(format!(
|
||||||
|
"Reddit rate limit exceeded. Try refreshing in a few seconds.\
|
||||||
|
Rate limit will reset in: {val}"
|
||||||
|
)),
|
||||||
None => Err("Reddit rate limit exceeded".to_string()),
|
None => Err("Reddit rate limit exceeded".to_string()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user