Commit 06400541 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix compilation errors

parent 9e96ee75
......@@ -23,7 +23,7 @@ type Queue struct {
func NewQueue(limit, queueLimit uint) *Queue {
return &Queue{
busyCh: make(chan struct{}, limit),
waitingCh: make(chan struct{}, queueLimit),
waitingCh: make(chan struct{}, limit+queueLimit),
}
}
......@@ -41,7 +41,9 @@ func (s *Queue) Acquire(timeout time.Duration) (err error) {
}
defer func() {
<-s.waitingCh
if err != nil {
<-s.waitingCh
}
}()
// fast path: push item to current processed items (non-blocking)
......@@ -69,5 +71,6 @@ func (s *Queue) Acquire(timeout time.Duration) (err error) {
// It triggers next request to be processed if it's in queue
func (s *Queue) Release() {
// dequeue from queue to allow next request to be processed
<-s.waitingCh
<-s.busyCh
}
......@@ -32,7 +32,7 @@ func TestNormalRequestProcessing(t *testing.T) {
// then it runs a number of requests that are going through queue,
// we return the response of first finished request,
// where status of request can be 200, 429 or 503
func testSlowRequestProcessing(count, limit, queueLimit uint, queueTimeout time.Duration) *httptest.ResponseRecorder {
func testSlowRequestProcessing(count int, limit, queueLimit uint, queueTimeout time.Duration) *httptest.ResponseRecorder {
pauseCh := make(chan struct{})
defer close(pauseCh)
......
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