Skip to content

Commit 81ef50c

Browse files
authored
repos: remove unread fields from graphql query (#1288)
We didn't actually read the majority of fields on the graphql query for repositories. So we remove all unread fields. In particular this removes the field "Language" which is expensive to compute if not cached. In practice I suspect this will dramatically improve the performance of "src repos list" command.
1 parent c9cbde0 commit 81ef50c

1 file changed

Lines changed: 2 additions & 39 deletions

File tree

cmd/src/repos.go

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"flag"
66
"fmt"
7-
"time"
87

98
"github.com/sourcegraph/sourcegraph/lib/errors"
109

@@ -51,53 +50,17 @@ Use "src repos [command] -h" for more information about a command.
5150

5251
const repositoryFragment = `
5352
fragment RepositoryFields on Repository {
54-
id
5553
name
56-
url
57-
description
58-
language
59-
createdAt
60-
updatedAt
61-
externalRepository {
62-
id
63-
serviceType
64-
serviceID
65-
}
6654
defaultBranch {
6755
name
6856
displayName
6957
}
70-
viewerCanAdminister
71-
keyValuePairs {
72-
key
73-
value
74-
}
7558
}
7659
`
7760

7861
type Repository struct {
79-
ID string `json:"id"`
80-
Name string `json:"name"`
81-
URL string `json:"url"`
82-
Description string `json:"description"`
83-
Language string `json:"language"`
84-
CreatedAt time.Time `json:"createdAt"`
85-
UpdatedAt *time.Time `json:"updatedAt"`
86-
ExternalRepository ExternalRepository `json:"externalRepository"`
87-
DefaultBranch GitRef `json:"defaultBranch"`
88-
ViewerCanAdminister bool `json:"viewerCanAdminister"`
89-
KeyValuePairs []KeyValuePair `json:"keyValuePairs"`
90-
}
91-
92-
type KeyValuePair struct {
93-
Key string `json:"key"`
94-
Value *string `json:"value"`
95-
}
96-
97-
type ExternalRepository struct {
98-
ID string `json:"id"`
99-
ServiceType string `json:"serviceType"`
100-
ServiceID string `json:"serviceID"`
62+
Name string `json:"name"`
63+
DefaultBranch GitRef `json:"defaultBranch"`
10164
}
10265

10366
type GitRef struct {

0 commit comments

Comments
 (0)