@@ -43,19 +43,29 @@ func (p *singleflightProxy) ReadWriteTx(ctx context.Context, f datastore.TxUserF
4343func (p * singleflightProxy ) OptimizedRevision (ctx context.Context ) (datastore.Revision , error ) {
4444 // NOTE: Optimized revisions are singleflighted by the underlying datastore via the
4545 // CachedOptimizedRevisions struct.
46+ ctx , span := tracer .Start (ctx , "singleflightProxy.OptimizedRevision" )
47+ defer span .End ()
4648 return p .delegate .OptimizedRevision (ctx )
4749}
4850
4951func (p * singleflightProxy ) CheckRevision (ctx context.Context , revision datastore.Revision ) error {
5052 _ , _ , err := p .checkRevGroup .Do (ctx , revision .String (), func (ctx context.Context ) (string , error ) {
51- return "" , p .delegate .CheckRevision (ctx , revision )
53+ // Sever the context so that a single caller's cancellation does not
54+ // abort the query for all other singleflight waiters.
55+ ctx , span := tracer .Start (ctx , "singleflightProxy.CheckRevision(sf)" )
56+ defer span .End ()
57+ return "" , p .delegate .CheckRevision (context .WithoutCancel (ctx ), revision )
5258 })
5359 return err
5460}
5561
5662func (p * singleflightProxy ) HeadRevision (ctx context.Context ) (datastore.Revision , error ) {
5763 rev , _ , err := p .headRevGroup .Do (ctx , "" , func (ctx context.Context ) (datastore.Revision , error ) {
58- return p .delegate .HeadRevision (ctx )
64+ // Sever the context so that a single caller's cancellation does not
65+ // abort the query for all other singleflight waiters.
66+ ctx , span := tracer .Start (ctx , "singleflightProxy.HeadRevision(sf)" )
67+ defer span .End ()
68+ return p .delegate .HeadRevision (context .WithoutCancel (ctx ))
5969 })
6070 return rev , err
6171}
0 commit comments