| OLD | NEW |
| 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 dscache | 5 package dscache |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "time" | 8 "time" |
| 9 | 9 |
| 10 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 }) | 33 }) |
| 34 } | 34 } |
| 35 | 35 |
| 36 func (d *dsCache) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetMu
ltiCB) error { | 36 func (d *dsCache) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetMu
ltiCB) error { |
| 37 lockItems, nonce := d.mkRandLockItems(keys, metas) | 37 lockItems, nonce := d.mkRandLockItems(keys, metas) |
| 38 if len(lockItems) == 0 { | 38 if len(lockItems) == 0 { |
| 39 return d.RawInterface.GetMulti(keys, metas, cb) | 39 return d.RawInterface.GetMulti(keys, metas, cb) |
| 40 } | 40 } |
| 41 | 41 |
| 42 if err := d.mc.AddMulti(lockItems); err != nil { | 42 if err := d.mc.AddMulti(lockItems); err != nil { |
| 43 » » (log.Fields{log.ErrorKey: err}).Warningf( | 43 » » // Ignore this error. Either we couldn't add them because they e
xist |
| 44 » » » d.c, "dscache: GetMulti: memcache.AddMulti") | 44 » » // (so, not an issue), or because memcache is having sad times (
in which |
| 45 | 45 » » // case we'll see so in the GetMulti which immediately follows t
his). |
| 46 } | 46 } |
| 47 if err := d.mc.GetMulti(lockItems); err != nil { | 47 if err := d.mc.GetMulti(lockItems); err != nil { |
| 48 (log.Fields{log.ErrorKey: err}).Warningf( | 48 (log.Fields{log.ErrorKey: err}).Warningf( |
| 49 d.c, "dscache: GetMulti: memcache.GetMulti") | 49 d.c, "dscache: GetMulti: memcache.GetMulti") |
| 50 } | 50 } |
| 51 | 51 |
| 52 p := makeFetchPlan(d.c, d.aid, d.ns, &facts{keys, metas, lockItems, nonc
e}) | 52 p := makeFetchPlan(d.c, d.aid, d.ns, &facts{keys, metas, lockItems, nonc
e}) |
| 53 | 53 |
| 54 if !p.empty() { | 54 if !p.empty() { |
| 55 // looks like we have something to pull from datastore, and mayb
e some work | 55 // looks like we have something to pull from datastore, and mayb
e some work |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if err == nil { | 132 if err == nil { |
| 133 err = txnState.apply(d.supportContext) | 133 err = txnState.apply(d.supportContext) |
| 134 } | 134 } |
| 135 return err | 135 return err |
| 136 }, opts) | 136 }, opts) |
| 137 if err == nil { | 137 if err == nil { |
| 138 txnState.release(d.supportContext) | 138 txnState.release(d.supportContext) |
| 139 } | 139 } |
| 140 return err | 140 return err |
| 141 } | 141 } |
| OLD | NEW |