Hi team - is there a recommendation of
# spicedb
z
Hi team - is there a recommendation of handling updating zookies for async updates? Our current design is upon updates to db objects, services call spicedb async (with a celery worker) to propagate changes. The issue is the zookie won't be returned to the service, and when service issues CheckPermission calls it won't have the updated zookie.
y
typically we recommend that the zedtoken be saved in the resource's row
if you're doing that, you can have the async job that writes to SpiceDB also write to the table
z
sorry just so i understand - lets say we have a user object stored in service db. you're saying on each row of the user table, the async task will write back the zedtoken? how would the service know which zedtoken to use when issuing CheckPermission calls that span multiple user rows?
y
not of the user table - it'd be the resource part of the relation write
and as for which token to use with something like
CheckBulkPermissions
, we don't currently have an easy way to compare zedtokens, but we're working on a proposal for a "zedtoken jar" that would address this use case
z
gotcha. what if i maintain a global zedtoken in each container running the service so it gets overwritten each time a async update happens? what's the tradeoff of storing separate zedtokens in each resource row?
y
the issue there is that you're functionally invalidating your cache every time there's a write
it's slightly better than
fully_consistent
, especially if your write velocity is relatively low, but it's much worse than using
minimize_latency
or a more fine-grained
at_least_as_fresh
approach
2 Views