added back load but with greater delay (random up to a sec between id's)

This commit is contained in:
Todd Gruben 2014-11-10 22:05:09 +00:00
parent d51ecd5115
commit df1886f8a2
2 changed files with 2 additions and 8 deletions

View file

@ -394,17 +394,11 @@ func (self *Brand) Load(requestChan chan Command, f *Fragment) {
//log.Println("Bad mojo")
}
time.Sleep(time.Duration(rand.Intn(15)) * time.Second) //trying to avoid mass cassandra hit
counter := 0
for _, k := range keys {
request := NewLoadRequest(k)
requestChan <- request
request.Response()
counter++
if counter > 100 {
backoff := (counter / 100) * 100
time.Sleep(time.Duration(backoff) * time.Millisecond) //trying to avoid mass cassandra hit
}
time.Sleep(time.Duration(rand.Intn(1000)) * time.Millisecond) //trying to avoid mass cassandra hit
}
}

View file

@ -287,7 +287,7 @@ func (self *FragmentContainer) AddFragment(db string, frame string, slice int, i
loader := make(chan Command)
self.fragments[id] = f
go f.ServeFragment(loader)
//go f.Load(loader)
go f.Load(loader)
}
}