Network hits
One snapshot, shared by every clone
.await, and a panic elsewhere in the process cannot poison it into a permanently unusable client.
Coalesced refreshes
Syncs are serialised. A burst of triggers - fifty concurrent reads on a stale snapshot, an SSE event storm, a TTL tick landing on top of both - produces one request at a time, so:- the SDK never opens a request per read,
- an older response can never overwrite a newer snapshot.
ETag / 304 Not Modified
TheETag from each 200 response is stored and sent back as If-None-Match. On 304:
- the snapshot is not replaced,
synced_atis updated, so the TTL clock resets,- the billing and quarantine states are cleared.
Bounded bodies
Every response the SDK parses has a size cap - 8 MiB for sync and AB evaluation, 1 MiB for the token exchange, 64 KiB for metadata. Exceeding it raisesResponseTooLarge; a truncated document is never handed to the parser.
Failure behaviour
On any non-2xx / non-304 response the SDK never clears the cache - reads keep serving the last known-good snapshot. In addition:With SSE active
Every event triggers a sync, so the cache is usually fresher than the TTL requires. The TTL timer keeps running as a fallback at exactly the interval you configured.Cleanup
close() does the same at a point you choose, and is idempotent. Dropping an individual clone does nothing - the shared state stays alive for the others.
std::process::exit skips destructors, so call close() if you exit that way and want the file secrets gone immediately. The SDK deliberately installs no signal handlers: a library that did would silently change how your application responds to Ctrl-C.
Diagnostics
tracing subscriber to see each sync, its outcome and the counts it applied:
