Skip to content

Commit

Permalink
sort shares/accesses in status call (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Oct 4, 2024
1 parent 5d57087 commit 3f00bb6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions agent/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package agent
import (
"context"
"github.com/openziti/zrok/agent/agentGrpc"
"sort"
)

func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusResponse, error) {
Expand All @@ -15,6 +16,9 @@ func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*
ResponseHeaders: acc.responseHeaders,
})
}
sort.Slice(accesses, func(i, j int) bool {
return accesses[i].FrontendToken < accesses[j].FrontendToken
})

var shares []*agentGrpc.ShareDetail
for token, shr := range i.agent.shares {
Expand All @@ -28,6 +32,9 @@ func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*
Closed: shr.closed,
})
}
sort.Slice(shares, func(i, j int) bool {
return shares[i].Token < shares[j].Token
})

return &agentGrpc.StatusResponse{Accesses: accesses, Shares: shares}, nil
}

0 comments on commit 3f00bb6

Please sign in to comment.