fix: avoid timeout if datacenter does not exist in topology (#5772)
* fix: avoid timeout if datacenter does not exist in topology * fix: error msg * fix: rm dublicate check * fix: compare * revert minor change
This commit is contained in:
committed by
GitHub
parent
3a82f5ffad
commit
04f4b10884
@@ -126,6 +126,13 @@ func (ms *MasterServer) dirAssignHandler(w http.ResponseWriter, r *http.Request)
|
||||
startTime = time.Now()
|
||||
)
|
||||
|
||||
if !ms.Topo.DataCenterExists(option.DataCenter) {
|
||||
writeJsonQuiet(w, r, http.StatusBadRequest, operation.AssignResult{
|
||||
Error: fmt.Sprintf("data center %v not found in topology", option.DataCenter),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
for time.Now().Sub(startTime) < maxTimeout {
|
||||
fid, count, dnList, shouldGrow, err := ms.Topo.PickForWrite(requestedCount, option, vl)
|
||||
if shouldGrow && !vl.HasGrowRequest() {
|
||||
|
||||
Reference in New Issue
Block a user