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

Side by Side Diff: filter/dscache/ds.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/dsQueryBatch/filter.go ('k') | filter/txnBuf/query_merger.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 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if err := d.mc.CompareAndSwapMulti(toCas); err != nil { 112 if err := d.mc.CompareAndSwapMulti(toCas); err != nil {
113 (log.Fields{log.ErrorKey: err}).Warningf( 113 (log.Fields{log.ErrorKey: err}).Warningf(
114 d.c, "dscache: GetMulti: memcache.Compar eAndSwapMulti") 114 d.c, "dscache: GetMulti: memcache.Compar eAndSwapMulti")
115 } 115 }
116 } 116 }
117 } 117 }
118 118
119 // finally, run the callback for all of the decoded items and the errors , 119 // finally, run the callback for all of the decoded items and the errors ,
120 // if any. 120 // if any.
121 for i, dec := range p.decoded { 121 for i, dec := range p.decoded {
122 » » cb(dec, p.lme.GetOne(i)) 122 » » if err := cb(dec, p.lme.GetOne(i)); err != nil {
123 » » » return err
124 » » }
123 } 125 }
124 126
125 return nil 127 return nil
126 } 128 }
127 129
128 func (d *dsCache) RunInTransaction(f func(context.Context) error, opts *ds.Trans actionOptions) error { 130 func (d *dsCache) RunInTransaction(f func(context.Context) error, opts *ds.Trans actionOptions) error {
129 txnState := dsTxnState{} 131 txnState := dsTxnState{}
130 err := d.RawInterface.RunInTransaction(func(ctx context.Context) error { 132 err := d.RawInterface.RunInTransaction(func(ctx context.Context) error {
131 txnState.reset() 133 txnState.reset()
132 err := f(context.WithValue(ctx, dsTxnCacheKey, &txnState)) 134 err := f(context.WithValue(ctx, dsTxnCacheKey, &txnState))
133 if err == nil { 135 if err == nil {
134 err = txnState.apply(d.supportContext) 136 err = txnState.apply(d.supportContext)
135 } 137 }
136 return err 138 return err
137 }, opts) 139 }, opts)
138 if err == nil { 140 if err == nil {
139 txnState.release(d.supportContext) 141 txnState.release(d.supportContext)
140 } 142 }
141 return err 143 return err
142 } 144 }
OLDNEW
« no previous file with comments | « filter/dsQueryBatch/filter.go ('k') | filter/txnBuf/query_merger.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698