mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid herding effect by double checking
This commit is contained in:
parent
1c044280d6
commit
1040761ab6
|
@ -193,7 +193,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stats) {
|
||||||
|
|
||||||
func readFiles(fileIdLineChan chan string, s *stats) {
|
func readFiles(fileIdLineChan chan string, s *stats) {
|
||||||
serverLimitChan := make(map[string]chan bool)
|
serverLimitChan := make(map[string]chan bool)
|
||||||
masterLimitChan := make(chan bool, 7)
|
masterLimitChan := make(chan bool, 1)
|
||||||
for {
|
for {
|
||||||
if fid, ok := <-fileIdLineChan; ok {
|
if fid, ok := <-fileIdLineChan; ok {
|
||||||
if len(fid) == 0 {
|
if len(fid) == 0 {
|
||||||
|
@ -210,10 +210,12 @@ func readFiles(fileIdLineChan chan string, s *stats) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
if server, ok := b.vid2server[vid]; !ok {
|
if server, ok := b.vid2server[vid]; !ok {
|
||||||
masterLimitChan <- true
|
masterLimitChan <- true
|
||||||
if ret, err := operation.Lookup(*b.server, vid); err == nil {
|
if _, now_ok := b.vid2server[vid]; !now_ok {
|
||||||
if len(ret.Locations) > 0 {
|
if ret, err := operation.Lookup(*b.server, vid); err == nil {
|
||||||
server = ret.Locations[0].PublicUrl
|
if len(ret.Locations) > 0 {
|
||||||
b.vid2server[vid] = server
|
server = ret.Locations[0].PublicUrl
|
||||||
|
b.vid2server[vid] = server
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<-masterLimitChan
|
<-masterLimitChan
|
||||||
|
|
Loading…
Reference in a new issue