Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
945e8b35
Commit
945e8b35
authored
Sep 29, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make apiLimit and apiQueueLimit to be of type uint
parent
3ccf29d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
internal/queueing/queue.go
internal/queueing/queue.go
+1
-1
internal/queueing/requests.go
internal/queueing/requests.go
+2
-2
internal/queueing/requests_test.go
internal/queueing/requests_test.go
+1
-1
internal/upstream/upstream.go
internal/upstream/upstream.go
+2
-2
main.go
main.go
+2
-2
No files found.
internal/queueing/queue.go
View file @
945e8b35
...
...
@@ -20,7 +20,7 @@ type Queue struct {
// limit specifies number of requests run concurrently
// queueLimit specifies maximum number of requests that can be queued
// if the number of requests is above the limit
func
NewQueue
(
limit
,
queueLimit
int
)
*
Queue
{
func
NewQueue
(
limit
,
queueLimit
u
int
)
*
Queue
{
return
&
Queue
{
busyCh
:
make
(
chan
struct
{},
limit
),
waitingCh
:
make
(
chan
struct
{},
queueLimit
),
...
...
internal/queueing/requests.go
View file @
945e8b35
...
...
@@ -9,8 +9,8 @@ import (
const
DefaultTimeout
=
30
*
time
.
Second
func
QueueRequests
(
h
http
.
Handler
,
limit
,
queueLimit
int
,
queueTimeout
time
.
Duration
)
http
.
Handler
{
if
queueLimit
==
0
||
limit
==
0
{
func
QueueRequests
(
h
http
.
Handler
,
limit
,
queueLimit
u
int
,
queueTimeout
time
.
Duration
)
http
.
Handler
{
if
limit
==
0
{
return
h
}
if
queueTimeout
==
0
{
...
...
internal/queueing/requests_test.go
View file @
945e8b35
...
...
@@ -28,7 +28,7 @@ func TestQueueRequests(t *testing.T) {
}
}
func
testSlowRequestProcessing
(
count
,
limit
,
queueLimit
int
,
queueTimeout
time
.
Duration
)
*
httptest
.
ResponseRecorder
{
func
testSlowRequestProcessing
(
count
,
limit
,
queueLimit
u
int
,
queueTimeout
time
.
Duration
)
*
httptest
.
ResponseRecorder
{
closeCh
:=
make
(
chan
struct
{})
defer
close
(
closeCh
)
...
...
internal/upstream/upstream.go
View file @
945e8b35
...
...
@@ -28,8 +28,8 @@ type Config struct {
DevelopmentMode
bool
Socket
string
ProxyHeadersTimeout
time
.
Duration
APILimit
int
APIQueueLimit
int
APILimit
u
int
APIQueueLimit
u
int
APIQueueTimeout
time
.
Duration
}
...
...
main.go
View file @
945e8b35
...
...
@@ -42,8 +42,8 @@ var documentRoot = flag.String("documentRoot", "public", "Path to static files c
var
proxyHeadersTimeout
=
flag
.
Duration
(
"proxyHeadersTimeout"
,
5
*
time
.
Minute
,
"How long to wait for response headers when proxying the request"
)
var
developmentMode
=
flag
.
Bool
(
"developmentMode"
,
false
,
"Allow to serve assets from Rails app"
)
var
secretPath
=
flag
.
String
(
"secretPath"
,
"./.gitlab_workhorse_secret"
,
"File with secret key to authenticate with authBackend"
)
var
apiLimit
=
flag
.
I
nt
(
"apiLimit"
,
0
,
"Number of API requests allowed at single time"
)
var
apiQueueLimit
=
flag
.
I
nt
(
"apiQueueLimit"
,
0
,
"Number of API requests allowed to be queued"
)
var
apiLimit
=
flag
.
Ui
nt
(
"apiLimit"
,
0
,
"Number of API requests allowed at single time"
)
var
apiQueueLimit
=
flag
.
Ui
nt
(
"apiQueueLimit"
,
0
,
"Number of API requests allowed to be queued"
)
var
apiQueueTimeout
=
flag
.
Duration
(
"apiQueueDuration"
,
queueing
.
DefaultTimeout
,
"Maximum queueing duration of requests"
)
func
main
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment