RateLimitedQueue TestTryOrdering could fail under load

Remove the possibility of contention in the test by providing a
synthetic Now() function.
This commit is contained in:
Clayton Coleman
2016-04-16 17:40:23 -04:00
parent c5df0bf23e
commit 08f136b8d9
2 changed files with 42 additions and 9 deletions

View File

@@ -164,7 +164,7 @@ func (q *RateLimitedTimedQueue) Try(fn ActionFunc) {
for ok {
// rate limit the queue checking
if !q.limiter.TryAccept() {
glog.V(10).Info("Try rate limitted...")
glog.V(10).Info("Try rate limited...")
// Try again later
break
}