From f4f7022dc744920ee7faa0e20dfd966a3ed1e3be Mon Sep 17 00:00:00 2001 From: Ben Papillon Date: Fri, 4 Sep 2026 17:01:35 -0700 Subject: [PATCH] chore(testapp): use default TTL for datastream entity caches In replicator mode the replicator writes companies to Redis without a TTL. track() writes the company back with the datastream cache TTL, so the 2s E2E TTL expired the entry and the replicator skipped later partial updates. Matches the Go testapp, which leaves the datastream caches on the 24h default. --- testapp/app.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/testapp/app.py b/testapp/app.py index f50448f..82b1ece 100644 --- a/testapp/app.py +++ b/testapp/app.py @@ -129,17 +129,22 @@ async def handle_configure(request: web.Request) -> web.Response: # DataStream / Replicator if get_config_bool("useDataStream"): cfg.use_datastream = True + # Entity caches keep the SDK default TTL (24h), matching the Go testapp. + # The short CACHE_TTL_MS is only for the flag-check cache above. In + # replicator mode the replicator owns the Redis entries and writes them + # without a TTL; track() writes the company back with ds.cache_ttl, so a + # 2s TTL here would expire the replicator's entry and make it skip + # subsequent partial updates ("No cached resource for partial company"). ds = DataStreamConfig() - ds.cache_ttl = CACHE_TTL_MS if redis_url: import redis.asyncio as aioredis redis_client = aioredis.from_url(redis_url) - ds.company_cache = RedisCache(redis_client, default_ttl_ms=CACHE_TTL_MS) - ds.company_lookup_cache = RedisCache(redis_client, default_ttl_ms=CACHE_TTL_MS) - ds.user_cache = RedisCache(redis_client, default_ttl_ms=CACHE_TTL_MS) - ds.user_lookup_cache = RedisCache(redis_client, default_ttl_ms=CACHE_TTL_MS) + ds.company_cache = RedisCache(redis_client) + ds.company_lookup_cache = RedisCache(redis_client) + ds.user_cache = RedisCache(redis_client) + ds.user_lookup_cache = RedisCache(redis_client) ds.flag_cache = RedisCache(redis_client, default_ttl_ms=FLAG_CACHE_TTL_MS) replicator_url = get_config_string("replicatorUrl")