@@ -261,15 +261,11 @@ func (c *Client) CreateSession(ctx context.Context, opts ...table.Option) (_ tab
261261 []retry.Option {
262262 retry .WithIdempotent (true ),
263263 retry .WithTrace (& trace.Retry {
264- OnRetry : func (info trace.RetryLoopStartInfo ) func (trace.RetryLoopIntermediateInfo ) func (trace. RetryLoopDoneInfo ) {
265- onIntermediate := trace .TableOnCreateSession (c .config .Trace (), info .Context , stack .FunctionID ("" ))
264+ OnRetry : func (info trace.RetryLoopStartInfo ) func (trace.RetryLoopDoneInfo ) {
265+ onDone := trace .TableOnCreateSession (c .config .Trace (), info .Context , stack .FunctionID ("" ))
266266
267- return func (info trace.RetryLoopIntermediateInfo ) func (trace.RetryLoopDoneInfo ) {
268- onDone := onIntermediate (info .Error )
269-
270- return func (info trace.RetryLoopDoneInfo ) {
271- onDone (s , info .Attempts , info .Error )
272- }
267+ return func (info trace.RetryLoopDoneInfo ) {
268+ onDone (s , info .Attempts , info .Error )
273269 }
274270 },
275271 }),
@@ -643,17 +639,16 @@ func (c *Client) Do(ctx context.Context, op table.Operation, opts ...table.Optio
643639
644640 config := c .retryOptions (opts ... )
645641
646- attempts , onIntermediate := 0 , trace .TableOnDo (config .Trace , & ctx ,
642+ attempts , onDone := 0 , trace .TableOnDo (config .Trace , & ctx ,
647643 stack .FunctionID ("" ),
648644 config .Label , config .Idempotent , xcontext .IsNestedCall (ctx ),
649645 )
650646 defer func () {
651- onIntermediate ( finalErr ) (attempts , finalErr )
647+ onDone (attempts , finalErr )
652648 }()
653649
654650 err := do (ctx , c , c .config , op , func (err error ) {
655651 attempts ++
656- onIntermediate (err )
657652 }, config .RetryOptions ... )
658653 if err != nil {
659654 return xerrors .WithStackTrace (err )
@@ -673,22 +668,18 @@ func (c *Client) DoTx(ctx context.Context, op table.TxOperation, opts ...table.O
673668
674669 config := c .retryOptions (opts ... )
675670
676- attempts , onIntermediate := 0 , trace .TableOnDoTx (config .Trace , & ctx ,
671+ attempts , onDone := 0 , trace .TableOnDoTx (config .Trace , & ctx ,
677672 stack .FunctionID ("" ),
678673 config .Label , config .Idempotent , xcontext .IsNestedCall (ctx ),
679674 )
680675 defer func () {
681- onIntermediate ( finalErr ) (attempts , finalErr )
676+ onDone (attempts , finalErr )
682677 }()
683678
684679 return retryBackoff (ctx , c ,
685680 func (ctx context.Context , s table.Session ) (err error ) {
686681 attempts ++
687682
688- defer func () {
689- onIntermediate (err )
690- }()
691-
692683 tx , err := s .BeginTransaction (ctx , config .TxSettings )
693684 if err != nil {
694685 return xerrors .WithStackTrace (err )
0 commit comments