Fix missing GatewayStats v4_migrate.

This is needed as the gateway_id field has changed from bytes to string
(as the Protobuf JSON mapping encodes bytes to base64).
This commit is contained in:
Orne Brocaar 2022-08-01 12:08:08 +01:00
parent 54d582504f
commit d7a4334b77
2 changed files with 9 additions and 0 deletions

8
api/rust/src/gw.rs vendored
View File

@ -277,3 +277,11 @@ impl DownlinkTxAck {
}
}
}
impl GatewayStats {
pub fn v4_migrate(&mut self) {
if self.gateway_id.is_empty() {
self.gateway_id = hex::encode(&self.gateway_id_legacy);
}
}
}

View File

@ -328,6 +328,7 @@ async fn message_callback(region_name: &str, region_common_name: CommonName, msg
})
.inc();
let mut event = chirpstack_api::gw::GatewayStats::decode(&mut Cursor::new(b))?;
event.v4_migrate();
event
.meta_data
.insert("region_name".to_string(), region_name.to_string());