return error early

fix https://github.com/chrislusf/seaweedfs/issues/2370
This commit is contained in:
Chris Lu 2021-10-11 01:24:30 -07:00
parent 4800d0ce26
commit e6ef7b2387

View file

@ -66,6 +66,10 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest
return grpcErr return grpcErr
} }
if resp.Error != "" {
return fmt.Errorf("assignRequest: %v", resp.Error)
}
ret.Count = resp.Count ret.Count = resp.Count
ret.Fid = resp.Fid ret.Fid = resp.Fid
ret.Url = resp.Location.Url ret.Url = resp.Location.Url
@ -80,10 +84,6 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest
}) })
} }
if resp.Error != "" {
return fmt.Errorf("assignRequest: %v", resp.Error)
}
return nil return nil
}) })