Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: filter/dsQueryBatch/filter.go

Issue 1846123002: Fix missing/broken ds.Stop handling in raw DS. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Better "count" helper function. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « filter/count/rds.go ('k') | filter/dscache/ds.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package dsQueryBatch 5 package dsQueryBatch
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 9
10 ds "github.com/luci/gae/service/datastore" 10 ds "github.com/luci/gae/service/datastore"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return err 50 return err
51 } 51 }
52 52
53 // If this is the last entry in our batch, get the curso r and stop this 53 // If this is the last entry in our batch, get the curso r and stop this
54 // query round. 54 // query round.
55 count++ 55 count++
56 if count >= f.batchSize { 56 if count >= f.batchSize {
57 if cursor, err = getCursor(); err != nil { 57 if cursor, err = getCursor(); err != nil {
58 return fmt.Errorf("failed to get cursor: %v", err) 58 return fmt.Errorf("failed to get cursor: %v", err)
59 } 59 }
60 return ds.Stop
60 } 61 }
61 return nil 62 return nil
62 }) 63 })
63 if err != nil && err != ds.Stop { 64 if err != nil && err != ds.Stop {
64 return err 65 return err
65 } 66 }
66 67
67 // If we have no cursor, we're done. 68 // If we have no cursor, we're done.
68 if cursor == nil { 69 if cursor == nil {
69 break 70 break
70 } 71 }
71 72
72 // Reduce our limit for the next round. 73 // Reduce our limit for the next round.
73 if hasLimit { 74 if hasLimit {
74 limit -= count 75 limit -= count
75 if limit <= 0 { 76 if limit <= 0 {
76 break 77 break
77 } 78 }
78 } 79 }
79 } 80 }
80 return nil 81 return nil
81 } 82 }
OLDNEW
« no previous file with comments | « filter/count/rds.go ('k') | filter/dscache/ds.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698