return UnknownKey instead of error
This commit is contained in:
parent
d98886db14
commit
88661fa865
@ -155,17 +155,16 @@ impl Web3ProxyApp {
|
|||||||
|
|
||||||
// if cache was empty, check the database
|
// if cache was empty, check the database
|
||||||
// TODO: i think there is a cleaner way to do this
|
// TODO: i think there is a cleaner way to do this
|
||||||
let user_data = if user_data.is_none() {
|
let user_data = match user_data {
|
||||||
self.cache_user_data(user_key)
|
None => self
|
||||||
|
.cache_user_data(user_key)
|
||||||
.await
|
.await
|
||||||
.context("no user data")?
|
.context("fetching user data for rate limits")?,
|
||||||
} else {
|
Some(user_data) => user_data,
|
||||||
// unwrap the cache's result
|
|
||||||
user_data.expect("we just checked the user_data is_none above")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if user_data.user_id == 0 {
|
if user_data.user_id == 0 {
|
||||||
return Err(anyhow::anyhow!("unknown key!"));
|
return Ok(RateLimitResult::UnknownKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// user key is valid. now check rate limits
|
// user key is valid. now check rate limits
|
||||||
|
Loading…
Reference in New Issue
Block a user