Skip to content

Commit 9e1f678

Browse files
authored
Merge pull request #120 from mitre/fix-metadata-batch
Add batch of 2k to metadata calls
2 parents 4c3eced + 8859e59 commit 9e1f678

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

cmd/mount.go

+22-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,28 @@ func mount(cmd *cobra.Command, args []string) (err error) {
149149
client := sdl.NewClient(endpoint, location, ngc, types)
150150
var accessions []*fuseralib.Accession
151151
if !eager {
152-
accessions, err = client.GetMetadata(accs)
152+
dot := 2000
153+
i := 0
154+
for dot < len(accs) {
155+
aa, err := client.GetMetadata(accs[i:dot])
156+
if err != nil {
157+
fmt.Println(err.Error())
158+
fmt.Println("List of accessions that failed in this batch:")
159+
fmt.Println(accs[i:dot])
160+
} else {
161+
accessions = append(accessions, aa...)
162+
}
163+
i = dot
164+
dot += batch
165+
}
166+
aa, err := client.GetMetadata(accs[i:])
167+
if err != nil {
168+
fmt.Println(err.Error())
169+
fmt.Println("List of accessions that failed in this batch:")
170+
fmt.Println(accs[i:])
171+
} else {
172+
accessions = append(accessions, aa...)
173+
}
153174
} else {
154175
dot := batch
155176
i := 0

0 commit comments

Comments
 (0)