Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Temporary errors due to Cosmos DB commit lag

Clémence Lesnéc19bb8660069
diff --git a/bicep/app.bicep b/bicep/app.bicep
index 94e69ad..3d12bc2 100644
--- a/bicep/app.bicep
+++ b/bicep/app.bicep
@@ -388,6 +388,11 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2023-11-15' = {
tags: tags
kind: 'GlobalDocumentDB'
properties: {
+ consistencyPolicy: {
+ defaultConsistencyLevel: 'BoundedStaleness' // ACID in a single-region, lag in the others
+ maxIntervalInSeconds: 600 // 5 mins lags at maximum
+ maxStalenessPrefix: 1000 // 1000 requests lags at max
+ }
databaseAccountOfferType: 'Standard'
locations: [
{
diff --git a/persistence/cosmos.py b/persistence/cosmos.py
index 1dedf48..e487aa5 100644
--- a/persistence/cosmos.py
+++ b/persistence/cosmos.py
@@ -116,6 +116,7 @@ class CosmosStore(IStore):
client = CosmosClient(
# Reliability
connection_timeout=5,
+ consistency_level="BoundedStaleness",
# Azure deployment
url=self._config.endpoint,
# Authentication with API key