Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
97d5a733
Commit
97d5a733
authored
May 20, 2016
by
Filip Grzadkowski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #25954 from wojtek-t/max_infligh_limit_logs
Log requests returning TooManyRequests error
parents
31c18258
f3c70ffe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
handlers.go
pkg/apiserver/handlers.go
+6
-2
No files found.
pkg/apiserver/handlers.go
View file @
97d5a733
...
@@ -119,12 +119,16 @@ func MaxInFlightLimit(c chan bool, longRunningRequestCheck LongRunningRequestChe
...
@@ -119,12 +119,16 @@ func MaxInFlightLimit(c chan bool, longRunningRequestCheck LongRunningRequestChe
defer
func
()
{
<-
c
}()
defer
func
()
{
<-
c
}()
handler
.
ServeHTTP
(
w
,
r
)
handler
.
ServeHTTP
(
w
,
r
)
default
:
default
:
tooManyRequests
(
w
)
tooManyRequests
(
r
,
w
)
}
}
})
})
}
}
func
tooManyRequests
(
w
http
.
ResponseWriter
)
{
func
tooManyRequests
(
req
*
http
.
Request
,
w
http
.
ResponseWriter
)
{
// "Too Many Requests" response is returned before logger is setup for the request.
// So we need to explicitly log it here.
defer
httplog
.
NewLogged
(
req
,
&
w
)
.
Log
()
// Return a 429 status indicating "Too Many Requests"
// Return a 429 status indicating "Too Many Requests"
w
.
Header
()
.
Set
(
"Retry-After"
,
RetryAfter
)
w
.
Header
()
.
Set
(
"Retry-After"
,
RetryAfter
)
http
.
Error
(
w
,
"Too many requests, please try again later."
,
errors
.
StatusTooManyRequests
)
http
.
Error
(
w
,
"Too many requests, please try again later."
,
errors
.
StatusTooManyRequests
)
...
...
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