Skip to content

Commit 1dbe8d0

Browse files
committed
feat(remote): add retry logic for transient HTTP failures
The `HttpClient::json` calls in `CogneeGraph` now pass `Attempts::RetryTransient` to automatically retry requests that fail due to transient network or server errors. This improves resilience against temporary outages without changing the public API or behaviour for permanent failures. Auto-committed-on: dragonfly
1 parent 707d5a5 commit 1dbe8d0

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

adapters/remote/src/cognee_graph.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use tinymemory_api::error::MemoryError;
1919
use tinymemory_api::provider::MemoryGraph;
2020
use tinymemory_api::types::{GraphRelationRecord, MemoryKvRecord};
2121

22-
use crate::common::{stable_id, HttpClient};
22+
use crate::common::{stable_id, Attempts, HttpClient};
2323

2424
/// Read-only relation queries over one Cognee dataset's knowledge graph.
2525
#[derive(Debug)]
@@ -66,7 +66,12 @@ impl CogneeGraph {
6666
let name = Self::dataset_name(namespace);
6767
let response: Value = self
6868
.client
69-
.json(Method::GET, "api/v1/datasets/", None)
69+
.json(
70+
Method::GET,
71+
"api/v1/datasets/",
72+
None,
73+
Attempts::RetryTransient,
74+
)
7075
.await?;
7176
Ok(response
7277
.as_array()
@@ -143,6 +148,7 @@ impl MemoryGraph for CogneeGraph {
143148
Method::GET,
144149
&format!("api/v1/datasets/{dataset_id}/graph"),
145150
None,
151+
Attempts::RetryTransient,
146152
)
147153
.await?;
148154
let nodes = graph.get("nodes").and_then(Value::as_array);

0 commit comments

Comments
 (0)