-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use SpiceDB directly instead of NATS KV for ZedToken updates #256
Conversation
NATS introduces an additional dependency for getting ZedToken updates that we don't really need if we can just use the SpiceDB Watch API. This commit updates the permissions-api server to use SpiceDB Watch instead for ZedToken updates. Signed-off-by: John Schaeffer <[email protected]>
ttl := status.TTL() | ||
// initZedTokenCache creates a new LRU cache that watches SpiceDB for ZedToken updates. | ||
func (e *engine) initZedTokenCache(ctx context.Context) error { | ||
ttl := time.Minute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: we should make this configurable based on the revision quantization interval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
for { | ||
resp, err := watchClient.Recv() | ||
if err != nil { | ||
e.logger.Errorf("error receiving updates", "error", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we exit this goroutine if the error is a context cancelled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like one of the tests need to be updated
Closing in favor of #257. |
NATS introduces an additional dependency for getting ZedToken updates that we don't really need if we can just use the SpiceDB Watch API. This PR updates the permissions-api server to use SpiceDB Watch instead for ZedToken updates.