You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ak...@apache.org on 2026/06/05 18:54:34 UTC

(tooling-gofannon) 02/02: re-export EVICTION_TTL_SECONDS as alias for backwards-compat

This is an automated email from the ASF dual-hosted git repository.

andrewmusselman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-gofannon.git

commit 6c89591cb027cc63ef301ee2168c8221fcdf2c9c
Author: Andrew Musselman <ak...@apache.org>
AuthorDate: Fri Jun 5 18:49:52 2026 +0000

    re-export EVICTION_TTL_SECONDS as alias for backwards-compat
    
    tests/unit/services/test_run_registry.py imports EVICTION_TTL_SECONDS
    from services.run_registry. The persistence patch renamed it to
    LOCAL_CACHE_TTL_SECONDS to reflect the split between in-memory cache
    eviction (LOCAL_CACHE_TTL_SECONDS) and CouchDB-side retention
    (COUCH_RETENTION_SECONDS). Add the old name back as an alias so the
    test (and any other code referencing the old constant) keeps working.
    
    The alias points at LOCAL_CACHE_TTL_SECONDS because that's what
    actually controls the behavior the test cares about: backdating
    _completed_at_monotonic past the alias value triggers
    _evict_expired_local on the next get(), which is what the test
    asserts. The 5-minute new value vs the old 1-hour value doesn't
    matter for the test -- it backdates by EVICTION_TTL_SECONDS + 10s,
    which is past either value.
---
 webapp/packages/api/user-service/services/run_registry.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/webapp/packages/api/user-service/services/run_registry.py b/webapp/packages/api/user-service/services/run_registry.py
index 91f4dda..dcc62ad 100644
--- a/webapp/packages/api/user-service/services/run_registry.py
+++ b/webapp/packages/api/user-service/services/run_registry.py
@@ -55,6 +55,17 @@ WORKER_ID = uuid.uuid4().hex
 # right after completion) don't re-fetch.
 LOCAL_CACHE_TTL_SECONDS = 300  # 5 minutes
 
+# Backwards-compat alias for the constant the pre-persistence code
+# called EVICTION_TTL_SECONDS. The name was specific to the old
+# meaning -- a single in-memory eviction TTL of 1 hour -- which now
+# split into LOCAL_CACHE_TTL_SECONDS (in-memory cache evict) and
+# COUCH_RETENTION_SECONDS (CouchDB eviction). External callers
+# (notably tests/unit/services/test_run_registry.py) imported the
+# old name; keep it pointing at the local cache TTL so existing
+# call sites that backdate _completed_at_monotonic past this value
+# still trigger eviction the way they expect.
+EVICTION_TTL_SECONDS = LOCAL_CACHE_TTL_SECONDS
+
 # CouchDB retention for completed runs. Runs older than this get
 # evicted by the periodic eviction task in app_factory's lifespan.
 COUCH_RETENTION_SECONDS = 7 * 24 * 3600  # 7 days


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org