https://authzed.com logo
#spicedb
Title
# spicedb
v

vroldanbet

01/24/2024, 8:39 AM
@arykalin this is by design. Please have a look at SpiceDB's tunable consistency model: https://authzed.com/docs/reference/api-consistency#levels Your request has
consistent: nil
, so the the server will, by default, assume
minimize_consistency
(see https://github.com/authzed/spicedb/blob/d2d874f2307dc852a7658322022c7b6b27fb42c4/internal/middleware/consistency/consistency.go#L106). And that's where your 2-5 lag comes from,
minimize_consistency
use a 5s second window (so called quantization window) to determine the snapshot revision of the data. So you'll request will use whatever revision was first loaded within that window, and keep it around cached for the duration of the window. Once it elapses, it will query for the latest snapshot revision again. What you are trying to achieve is thus
read your writes
consistency (see https://jepsen.io/consistency/models/read-your-writes), and thus you need to use
at_least_as_fresh
consistency if you have the zedtoken of the write you did around, of
fully_consistent
in case you don't have it. Please note the former is the recomended approach, as the later completely bypasses any kind of caching.