Skip to content

Commit

Permalink
fix(ai-help): fix double decrement (#550)
Browse files Browse the repository at this point in the history
This was caused by a bad merge :/
  • Loading branch information
fiji-flo authored Aug 21, 2024
1 parent d533eda commit 78fea88
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/api/ai_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,19 +392,7 @@ pub async fn ai_help(
&mut ai_help_req_meta,
)
.await;
// Reinstate the user quota if we fail to do the preparation step.
// Flagged/moderation errors DO count towards the limit, otherwise
// it is on us.
match prepare_res {
Err(crate::ai::error::AIError::OpenAIError(_))
| Err(crate::ai::error::AIError::TiktokenError(_))
| Err(crate::ai::error::AIError::TokenLimit)
| Err(crate::ai::error::AIError::SqlXError(_))
| Err(crate::ai::error::AIError::NoUserPrompt) => {
let _ = decrement_limit(&mut conn, &user);
}
_ => (),
}

let user_id = user.id;

match prepare_res {
Expand Down

0 comments on commit 78fea88

Please sign in to comment.