mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
fix(gateway): preserve affinity during quota telemetry
This commit is contained in:
@@ -424,7 +424,7 @@ async fn sync_grok_quota_from_report_context(
|
|||||||
updated_key.updated_at_unix_secs = Some(now_unix_secs);
|
updated_key.updated_at_unix_secs = Some(now_unix_secs);
|
||||||
|
|
||||||
Ok(state
|
Ok(state
|
||||||
.update_provider_catalog_key(&updated_key)
|
.update_provider_catalog_key_runtime_state(&updated_key)
|
||||||
.await?
|
.await?
|
||||||
.is_some())
|
.is_some())
|
||||||
}
|
}
|
||||||
@@ -721,7 +721,7 @@ async fn sync_codex_quota_from_response_headers(
|
|||||||
updated_key.updated_at_unix_secs = Some(now_unix_secs);
|
updated_key.updated_at_unix_secs = Some(now_unix_secs);
|
||||||
|
|
||||||
let updated = state
|
let updated = state
|
||||||
.update_provider_catalog_key(&updated_key)
|
.update_provider_catalog_key_runtime_state(&updated_key)
|
||||||
.await?
|
.await?
|
||||||
.is_some();
|
.is_some();
|
||||||
if updated {
|
if updated {
|
||||||
|
|||||||
@@ -615,6 +615,21 @@ impl AppState {
|
|||||||
Ok(updated)
|
Ok(updated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn update_provider_catalog_key_runtime_state(
|
||||||
|
&self,
|
||||||
|
key: &provider_catalog::StoredProviderCatalogKey,
|
||||||
|
) -> Result<Option<provider_catalog::StoredProviderCatalogKey>, GatewayError> {
|
||||||
|
let updated = self
|
||||||
|
.data
|
||||||
|
.update_provider_catalog_key(key)
|
||||||
|
.await
|
||||||
|
.map_err(|err| GatewayError::Internal(err.to_string()))?;
|
||||||
|
if updated.is_some() {
|
||||||
|
self.invalidate_provider_health_routing_caches();
|
||||||
|
}
|
||||||
|
Ok(updated)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn update_provider_catalog_key_upstream_metadata(
|
pub(crate) async fn update_provider_catalog_key_upstream_metadata(
|
||||||
&self,
|
&self,
|
||||||
key_id: &str,
|
key_id: &str,
|
||||||
|
|||||||
Reference in New Issue
Block a user