mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-18 14:00:39 +00:00
chore: add rate limit status code (#1923)
This commit is contained in:
@@ -66,6 +66,9 @@ pub enum StatusCode {
|
||||
// ====== Begin of server related status code =====
|
||||
/// Runtime resources exhausted, like creating threads failed.
|
||||
RuntimeResourcesExhausted = 6000,
|
||||
|
||||
/// Rate limit exceeded
|
||||
RateLimited = 6001,
|
||||
// ====== End of server related status code =======
|
||||
|
||||
// ====== Begin of auth related status code =====
|
||||
@@ -111,6 +114,7 @@ impl StatusCode {
|
||||
| StatusCode::TableColumnNotFound
|
||||
| StatusCode::TableColumnExists
|
||||
| StatusCode::DatabaseNotFound
|
||||
| StatusCode::RateLimited
|
||||
| StatusCode::UserNotFound
|
||||
| StatusCode::UnsupportedPasswordType
|
||||
| StatusCode::UserPasswordMismatch
|
||||
@@ -141,6 +145,7 @@ impl StatusCode {
|
||||
| StatusCode::TableColumnNotFound
|
||||
| StatusCode::TableColumnExists
|
||||
| StatusCode::DatabaseNotFound
|
||||
| StatusCode::RateLimited
|
||||
| StatusCode::UserNotFound
|
||||
| StatusCode::UnsupportedPasswordType
|
||||
| StatusCode::UserPasswordMismatch
|
||||
|
||||
@@ -432,7 +432,7 @@ fn status_to_tonic_code(status_code: StatusCode) -> Code {
|
||||
| StatusCode::DatabaseNotFound
|
||||
| StatusCode::UserNotFound => Code::NotFound,
|
||||
StatusCode::StorageUnavailable => Code::Unavailable,
|
||||
StatusCode::RuntimeResourcesExhausted => Code::ResourceExhausted,
|
||||
StatusCode::RuntimeResourcesExhausted | StatusCode::RateLimited => Code::ResourceExhausted,
|
||||
StatusCode::UnsupportedPasswordType
|
||||
| StatusCode::UserPasswordMismatch
|
||||
| StatusCode::AuthHeaderNotFound
|
||||
|
||||
Reference in New Issue
Block a user