Commit 6bd21675 authored by Stefan Dähling's avatar Stefan Dähling
Browse files

fix ineffective break statements

parent f82747df
Pipeline #467016 passed with stages
in 11 minutes and 27 seconds
......@@ -226,10 +226,14 @@ func (logCol *LogCollector) storeState() (err error) {
states = append(states, state)
for i := 0; i < 24; i++ {
// maximum of 25 states
done := false
select {
case state = <-logCol.stateIn:
states = append(states, state)
default:
done = true
}
if done {
break
}
}
......
......@@ -278,6 +278,7 @@ func (stor *cassStorage) storeLogs(topic string) {
if size > 25000 {
break
}
empty := false
select {
case log = <-logIn:
js, err = json.Marshal(log)
......@@ -287,6 +288,9 @@ func (stor *cassStorage) storeLogs(topic string) {
batch.Query(stmt, log.MASID, log.AgentID, log.Timestamp, js)
size += len(js)
default:
empty = true
}
if empty {
break
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment