Skip to content
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

Closed

Conversation

jnschaeffer
Copy link
Contributor

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.

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]>
@jnschaeffer jnschaeffer requested review from a team as code owners May 15, 2024 14:49
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
Copy link
Contributor Author

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.

Copy link
Contributor

@mikemrm mikemrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Comment on lines +50 to +53
for {
resp, err := watchClient.Recv()
if err != nil {
e.logger.Errorf("error receiving updates", "error", err)
Copy link
Contributor

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?

Copy link
Contributor

@bailinhe bailinhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnschaeffer
Copy link
Contributor Author

Closing in favor of #257.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants