mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 10:06:14 +00:00
fix(access): force to send message to proxy and client cleans up
. #22411498 Signed-off-by: slasher <shenjie1@oppo.com>
This commit is contained in:
parent
6d8981bf9c
commit
3d33e4f992
@ -322,6 +322,8 @@ func (h *Handler) Admin() interface{} {
|
||||
}
|
||||
|
||||
func (h *Handler) sendRepairMsgBg(ctx context.Context, blob blobIdent, badIdxes []uint8) {
|
||||
span := trace.SpanFromContextSafe(ctx)
|
||||
_, ctx = trace.StartSpanFromContextWithTraceID(context.Background(), "", span.TraceID())
|
||||
go func() {
|
||||
h.sendRepairMsg(ctx, blob, badIdxes)
|
||||
}()
|
||||
|
||||
@ -532,16 +532,18 @@ func (c *client) putParts(ctx context.Context, args *PutArgs) (Location, HashSum
|
||||
return
|
||||
}
|
||||
|
||||
// force to clean up, even canceled context
|
||||
_, newCtx := trace.StartSpanFromContextWithTraceID(context.Background(), "", span.TraceID())
|
||||
locations := signArgs.Locations[:]
|
||||
if len(locations) > 1 {
|
||||
signArgs.Location = loc.Copy()
|
||||
signResp := &SignResp{}
|
||||
if err := rpcClient.PostWith(ctx, "/sign", signResp, signArgs); err == nil {
|
||||
if err := rpcClient.PostWith(newCtx, "/sign", signResp, signArgs); err == nil {
|
||||
locations = []Location{signResp.Location.Copy()}
|
||||
}
|
||||
}
|
||||
if len(locations) > 0 {
|
||||
if _, err := c.Delete(ctx, &DeleteArgs{Locations: locations}); err != nil {
|
||||
if _, err := c.Delete(newCtx, &DeleteArgs{Locations: locations}); err != nil {
|
||||
span.Warnf("clean location '%+v' failed %s", locations, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@ -629,16 +629,18 @@ func (s *sdkHandler) putParts(ctx context.Context, args *acapi.PutArgs) (acapi.L
|
||||
return
|
||||
}
|
||||
|
||||
// force to clean up, even canceled context
|
||||
_, newCtx := trace.StartSpanFromContextWithTraceID(context.Background(), "", span.TraceID())
|
||||
locations := signArgs.Locations[:]
|
||||
if len(locations) > 1 {
|
||||
signArgs.Location = loc.Copy()
|
||||
signResp, err := s.sign(ctx, &signArgs)
|
||||
signResp, err := s.sign(newCtx, &signArgs)
|
||||
if err == nil {
|
||||
locations = []acapi.Location{signResp.Location.Copy()}
|
||||
}
|
||||
}
|
||||
if len(locations) > 0 {
|
||||
if _, err := s.Delete(ctx, &acapi.DeleteArgs{Locations: locations}); err != nil {
|
||||
if _, err := s.Delete(newCtx, &acapi.DeleteArgs{Locations: locations}); err != nil {
|
||||
span.Warnf("clean location '%+v' failed %s", locations, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user