Index: filter/count/rds.go |
diff --git a/filter/count/rds.go b/filter/count/rds.go |
index eeeccc520163d5eada3f771154617164c3df35da..69e903aea911634fca022ddd4881380048793255 100644 |
--- a/filter/count/rds.go |
+++ b/filter/count/rds.go |
@@ -5,7 +5,6 @@ |
package count |
import ( |
- "github.com/luci/luci-go/common/errors" |
"golang.org/x/net/context" |
ds "github.com/luci/gae/service/datastore" |
@@ -42,7 +41,7 @@ func (r *dsCounter) DecodeCursor(s string) (ds.Cursor, error) { |
} |
func (r *dsCounter) Run(q *ds.FinalizedQuery, cb ds.RawRunCB) error { |
- return r.c.Run.up(errors.Filter(r.ds.Run(q, cb), ds.Stop)) |
+ return r.c.Run.upFilterStop(r.ds.Run(q, cb)) |
} |
func (r *dsCounter) Count(q *ds.FinalizedQuery) (int64, error) { |
@@ -55,15 +54,15 @@ func (r *dsCounter) RunInTransaction(f func(context.Context) error, opts *ds.Tra |
} |
func (r *dsCounter) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error { |
- return r.c.DeleteMulti.up(errors.Filter(r.ds.DeleteMulti(keys, cb), ds.Stop)) |
+ return r.c.DeleteMulti.upFilterStop(r.ds.DeleteMulti(keys, cb)) |
} |
func (r *dsCounter) GetMulti(keys []*ds.Key, meta ds.MultiMetaGetter, cb ds.GetMultiCB) error { |
- return r.c.GetMulti.up(errors.Filter(r.ds.GetMulti(keys, meta, cb), ds.Stop)) |
+ return r.c.GetMulti.upFilterStop(r.ds.GetMulti(keys, meta, cb)) |
} |
func (r *dsCounter) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error { |
- return r.c.PutMulti.up(errors.Filter(r.ds.PutMulti(keys, vals, cb), ds.Stop)) |
+ return r.c.PutMulti.upFilterStop(r.ds.PutMulti(keys, vals, cb)) |
} |
func (r *dsCounter) Testable() ds.Testable { |
@@ -77,3 +76,15 @@ func FilterRDS(c context.Context) (context.Context, *DSCounter) { |
return &dsCounter{state, ds} |
}), state |
} |
+ |
+// upFilterStop wraps up, handling the special case datastore.Stop error. |
+// datastore.Stop will pass through this function, but, unlike other error |
+// codes, will be counted as a success. |
+func (e *Entry) upFilterStop(err error) error { |
+ upErr := err |
+ if upErr == ds.Stop { |
+ upErr = nil |
+ } |
+ e.up(upErr) |
+ return err |
+} |