Skip to content

Commit

Permalink
Bump if counter returns error
Browse files Browse the repository at this point in the history
Summary:
According to https://fb.prod.workplace.com/groups/1989752134610829/permalink/3773211902931501/ fetching the counter is eventually consistent, and might return an error if it's only been recently created. We will often hit this case as new counter swill have to be created for each client_main_id.

This diff stopps these errors from being logged to scuba to avoid retention issues, and bumps the counter to ensure a value is set for accuracy for the next request

Differential Revision: D68157804

fbshipit-source-id: 09a6a9c73f352fa040af4d4fd250fe4f07510d60
  • Loading branch information
Clara Rull authored and facebook-github-bot committed Jan 14, 2025
1 parent 567f047 commit 3dab27a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eden/mononoke/edenapi_service/src/utils/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ pub async fn counter_check_and_bump<'a>(
}
}
Ok(Err(e)) => {
// This can happen if the counter is not yet initialized
// or it's not been long enough. Bump and continue.
debug!(
ctx.logger(),
"Failed getting rate limiting counter {}: {:?}", rate_limit_name, e
);
let msg = format!("{}: Failed", rate_limit_name);
scuba.log_with_msg(&msg, None);
counter.bump(1.0);
Ok(())
}
Err(_) => {
Expand Down

0 comments on commit 3dab27a

Please sign in to comment.