Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
josephschorr committed Oct 18, 2024
1 parent afad40e commit 7337008
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions internal/datastore/spanner/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ func queryExecutor(txSource txFactory) common.ExecuteQueryFunc {
span.AddEvent("start reading iterator")
defer span.AddEvent("finished reading iterator")

relCount := 0
defer span.SetAttributes(attribute.Int("count", relCount))

if err := iter.Do(func(row *spanner.Row) error {
var resourceObjectType string
var resourceObjectID string
Expand Down Expand Up @@ -210,6 +213,7 @@ func queryExecutor(txSource txFactory) common.ExecuteQueryFunc {
return err
}

relCount++
if !yield(tuple.Relationship{
RelationshipReference: tuple.RelationshipReference{
Resource: tuple.ObjectAndRelation{
Expand Down
12 changes: 3 additions & 9 deletions internal/services/v1/experimental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
"github.com/authzed/grpcutil"
"github.com/ccoveille/go-safecast"
"github.com/jzelinskie/stringz"
"github.com/scylladb/go-set"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
Expand Down Expand Up @@ -644,11 +645,7 @@ func TestBulkCheckPermission(t *testing.T) {
},
}

rel := reqRel.Subject.Relation
if rel == tuple.Ellipsis {
rel = ""
}

rel := stringz.Default(reqRel.Subject.Relation, "", tuple.Ellipsis)
pair := &v1.BulkCheckPermissionPair{
Request: &v1.BulkCheckPermissionRequestItem{
Resource: &v1.ObjectReference{
Expand Down Expand Up @@ -701,10 +698,7 @@ func TestBulkCheckPermission(t *testing.T) {

func relToBulkRequestItem(rel string) *v1.BulkCheckPermissionRequestItem {
r := tuple.MustParse(rel)
subjectRel := r.Subject.Relation
if subjectRel == tuple.Ellipsis {
subjectRel = ""
}
subjectRel := stringz.Default(r.Subject.Relation, "", tuple.Ellipsis)

item := &v1.BulkCheckPermissionRequestItem{
Resource: &v1.ObjectReference{
Expand Down

0 comments on commit 7337008

Please sign in to comment.