https://authzed.com logo
LookupResources randomly yields empty result
s

SparkleStorm

02/22/2023, 6:32 PM
Hello SpiceDB team, we are using the official spicedb client library for Go in our app. When calling LookupResources, the result is empty from time to time, even though we always use full consistency.
j

Joey

02/22/2023, 6:33 PM
the last time this was reported, it was because the caller wasn't consuming the stream correctly
make sure you're always looping fully over the stream, like here: https://github.com/authzed/zed/blob/main/internal/commands/permission.go#L333
s

SparkleStorm

02/22/2023, 8:21 PM
thanks Joey for the answer, looks like it was something in our code
j

Joey

02/22/2023, 8:22 PM
do you happen to know what?
I'd like to document it
prevent others from encountering the same problem 🙂
s

SparkleStorm

02/22/2023, 8:24 PM
We are using a context with timeout of 5s in our request, which we then passed to LookupResources, but the response is taking more than 5s and spicedb returns an error
Lookup resources iteration failed: rpc error: code = DeadlineExceeded desc = context deadline exceeded
but our code was discarding this error and thus returning an empty result
j

Joey

02/22/2023, 8:26 PM
gotcha
I'll keep that in mind for future reference
it should be noted that 5s is also a long time: we are working on improvements to reduce that significantly for super large data sets
p

pdd

02/23/2023, 2:44 PM
Joey, what kind of improvement in performance might be possible? 20%, 2x, 4x?
j

Joey

02/23/2023, 5:57 PM
unknown; its something we're exploring
however, long term https://github.com/authzed/spicedb/issues/207 is the solution