Skip to content

Commit

Permalink
fail region params lookup on db error
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffgrunewald committed Jul 7, 2023
1 parent c4cc3ce commit 8fb64bd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion iot_config/src/gateway_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,23 @@ impl iot_config::Gateway for GatewayService {
})?;

let (region, gain) = match self.resolve_gateway_info(address).await {
Err(_) => {
Err(status) if status.code() == tonic::Code::NotFound => {
tracing::debug!(
pubkey = %address,
%default_region,
"unable to retrieve gateway from chain"
);
(default_region, 0)
}
Err(status) => {
tracing::error!(
pubkey = %address,
%default_region,
"gateway lookup failed"
);
telemetry::count_region_lookup(default_region, Region::Unknown);
return Err(Status::internal(status.message().to_string()));
}
Ok(GatewayInfo { metadata, .. }) => match metadata {
None => {
tracing::debug!(
Expand Down

0 comments on commit 8fb64bd

Please sign in to comment.