mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix entry full url lookup
This commit is contained in:
parent
9c517d2b35
commit
3ce46c3566
|
@ -44,6 +44,9 @@ func (mc *MasterClient) GetLookupFileIdFunction() LookupFileIdFunctionType {
|
||||||
|
|
||||||
func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []string, err error) {
|
func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []string, err error) {
|
||||||
fullUrls, err = mc.vidMap.LookupFileId(fileId)
|
fullUrls, err = mc.vidMap.LookupFileId(fileId)
|
||||||
|
if err == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
err = pb.WithMasterClient(false, mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
|
err = pb.WithMasterClient(false, mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
|
||||||
resp, err := client.LookupVolume(context.Background(), &master_pb.LookupVolumeRequest{
|
resp, err := client.LookupVolume(context.Background(), &master_pb.LookupVolumeRequest{
|
||||||
VolumeOrFileIds: []string{fileId},
|
VolumeOrFileIds: []string{fileId},
|
||||||
|
@ -59,7 +62,7 @@ func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []stri
|
||||||
GrpcPort: int(vidLoc.GrpcPort),
|
GrpcPort: int(vidLoc.GrpcPort),
|
||||||
}
|
}
|
||||||
mc.vidMap.addLocation(uint32(vid), loc)
|
mc.vidMap.addLocation(uint32(vid), loc)
|
||||||
fullUrls = append(fullUrls, loc.Url)
|
fullUrls = append(fullUrls, "http://"+loc.Url+"/"+fileId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue