FlowNotFound says whether a published flow or any flow is missing; read_all stamps its cache with the revision from before its scan; dashboard discard and delete commits name the key; a RedisState ttl expires counters and the names set too; bench_startup publishes the version after its saves, and only when there is a draft

This commit is contained in:
2026-11-04 21:20:29 +01:00
parent b7f1d21712
commit eb17528ce6
5 changed files with 70 additions and 16 deletions
+13 -3
View File
@@ -639,6 +639,14 @@ class RedisState(StateBackend):
names = [k for k in keys if not k.startswith("__")]
if names:
pipe.sadd(self._names_key(), *names)
if self._ttl:
pipe.expire(self._names_key(), self._ttl)
def _incr(self, pipe: Any, key: str) -> None:
"""INCR a counter in the caller's pipeline, expiring with the values."""
pipe.incr(self._key(key))
if self._ttl:
pipe.expire(self._key(key), self._ttl)
def set(self, key: str, value: Any) -> None:
data = self._serialize(value)
@@ -747,7 +755,9 @@ class RedisState(StateBackend):
def increment(self, key: str) -> int:
"""Atomically increment a counter using Redis INCR."""
return cast(int, self._client.incr(self._key(key)))
pipe = self._client.pipeline()
self._incr(pipe, key)
return cast(int, pipe.execute()[0])
def increment_multi(self, keys: list[str]) -> None:
"""Bump every counter in one round trip rather than one INCR each."""
@@ -755,7 +765,7 @@ class RedisState(StateBackend):
return
pipe = self._client.pipeline()
for key in keys:
pipe.incr(self._key(key))
self._incr(pipe, key)
pipe.execute()
def get_multi(self, keys: list[str]) -> dict[str, Any]:
@@ -916,7 +926,7 @@ class RedisState(StateBackend):
if self._ttl:
pipe.expire(history_key, self._ttl)
for key in counters:
pipe.incr(self._key(key))
self._incr(pipe, key)
self._note(pipe, values)
pipe.execute()