Chromium Code Reviews| Index: go/src/infra/gae/libs/meta/eg.go |
| diff --git a/go/src/infra/gae/libs/meta/eg.go b/go/src/infra/gae/libs/meta/eg.go |
| index 8522d5051d6dc7f5e98c26c8d945cb605a1780f0..c7038e5fbf5490ce87517aaaec264d4fe8e99c0b 100644 |
| --- a/go/src/infra/gae/libs/meta/eg.go |
| +++ b/go/src/infra/gae/libs/meta/eg.go |
| @@ -10,6 +10,7 @@ import ( |
| "github.com/luci/luci-go/common/errors" |
| "infra/gae/libs/gae" |
| + "infra/gae/libs/gae/helper" |
| ) |
| var mark = errors.MakeMarkFn("eg") |
| @@ -28,15 +29,15 @@ func GetEntityGroupVersion(c context.Context, root gae.DSKey) (int64, error) { |
| for root.Parent() != nil { |
| root = root.Parent() |
| } |
| - egm := &EntityGroupMeta{} |
| rds := gae.GetRDS(c) |
| - err := rds.Get(rds.NewKey("__entity_group__", "", 1, root), egm) |
| - if err != gae.ErrDSNoSuchEntity { |
| - err = mark(err) |
| - } else { |
| + egm := &EntityGroupMeta{} |
| + ret := int64(0) |
|
dnj
2015/07/14 19:34:57
Why bother with this assignment when you can just
iannucci
2015/07/14 22:45:48
Done.
|
| + err := rds.Get(rds.NewKey("__entity_group__", "", 1, root), helper.GetPLS(egm)) |
| + ret = egm.Version |
| + if err == gae.ErrDSNoSuchEntity { |
| // this is OK for callers. The version of the entity group is effectively 0 |
| // in this case. |
| err = nil |
| } |
| - return egm.Version, err |
| + return ret, err |
| } |