1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-08 05:47:07 +09:00

GO-5748: Fix minor data-race in rpcstore

This commit is contained in:
Sergey 2025-06-04 15:13:36 +02:00
parent 5351c20fa3
commit 1d0bb790f0
No known key found for this signature in database
GPG key ID: 3B6BEF79160221C6

View file

@ -226,15 +226,16 @@ func writeOperation[T any](backgroundCtx context.Context, ctx context.Context, s
ready := make(chan result, 1)
ctx = context.WithValue(ctx, operationNameKey, operationName)
var res T
var defaultRes T
if err := s.cm.WriteOp(ctx, ready, func(c *client) error {
var opErr error
res, opErr = fn(c)
return opErr
}, cid.Cid{}); err != nil {
return res, err
return defaultRes, err
}
if err := waitResult(backgroundCtx, ctx, ready); err != nil {
return res, err
return defaultRes, err
}
return res, nil
}