fix(codex): fence concurrent quota updates

This commit is contained in:
elky
2026-08-14 09:28:07 +08:00
parent f3a12c1008
commit 5b0c763086
65 changed files with 13009 additions and 738 deletions
+15
View File
@@ -662,6 +662,21 @@ impl AppState {
Ok(updated)
}
pub(crate) async fn compare_and_update_provider_catalog_key_admin_state(
&self,
update: &provider_catalog::ProviderCatalogKeyAdminCasUpdate,
) -> Result<bool, GatewayError> {
let updated = self
.data
.compare_and_update_provider_catalog_key_admin_state(update)
.await
.map_err(|err| GatewayError::Internal(err.to_string()))?;
// A conflict means another instance changed credentials. Invalidate on
// both outcomes before the caller reloads or reports the conflict.
self.invalidate_provider_routing_caches();
Ok(updated)
}
pub(crate) async fn update_provider_catalog_keys(
&self,
keys: &[provider_catalog::StoredProviderCatalogKey],