Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions service/history/queue_factory_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,17 @@ func NewHostRateLimiterRateFn(
return float64(maxPollHostRps)
}

// ensure queue loading won't consume all persistence tokens
// especially upon host restart when we need to perform a load
// for all shards
return float64(persistenceMaxRPS()) * persistenceMaxRPSRatio
if pMaxRPS := persistenceMaxRPS(); pMaxRPS > 0 {
// ensure queue loading won't consume all persistence tokens
// especially upon host restart when we need to perform a load
// for all shards
return float64(pMaxRPS) * persistenceMaxRPSRatio
}

// persistenceMaxQPS=0 means "unlimited" — use a high default to avoid
// producing a zero rate which would block all queue readers.
// NOTE: Do not use math.MaxFloat64 here; int(math.MaxFloat64) overflows
// to math.MinInt64, which breaks burst calculation in the rate limiter.
return 100_000
}
}
1 change: 1 addition & 0 deletions service/history/queues/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ func (r *ReaderImpl) loadAndSubmitTasks() {

// this should never happen
r.logger.Error("Queue reader rate limiter burst size is smaller than required token count")
return
}

r.Lock()
Expand Down
Loading