Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
43073da7
Commit
43073da7
authored
Mar 10, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(renderer): add timeout for the renderer api
closes #4325
parent
0b6fee13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
pkg/api/render.go
+1
-0
pkg/components/renderer/renderer.go
+8
-1
No files found.
pkg/api/render.go
View file @
43073da7
...
...
@@ -31,6 +31,7 @@ func RenderToPng(c *middleware.Context) {
Width
:
queryReader
.
Get
(
"width"
,
"800"
),
Height
:
queryReader
.
Get
(
"height"
,
"400"
),
SessionId
:
c
.
Session
.
ID
(),
Timeout
:
queryReader
.
Get
(
"timeout"
,
"15"
),
}
renderOpts
.
Url
=
setting
.
ToAbsUrl
(
renderOpts
.
Url
)
...
...
pkg/components/renderer/renderer.go
View file @
43073da7
...
...
@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
"strconv"
)
type
RenderOpts
struct
{
...
...
@@ -18,6 +19,7 @@ type RenderOpts struct {
Width
string
Height
string
SessionId
string
Timeout
string
}
func
RenderToPng
(
params
*
RenderOpts
)
(
string
,
error
)
{
...
...
@@ -60,8 +62,13 @@ func RenderToPng(params *RenderOpts) (string, error) {
close
(
done
)
}()
timeout
,
err
:=
strconv
.
Atoi
(
params
.
Timeout
)
if
err
!=
nil
{
timeout
=
15
}
select
{
case
<-
time
.
After
(
15
*
time
.
Second
)
:
case
<-
time
.
After
(
time
.
Duration
(
timeout
)
*
time
.
Second
)
:
if
err
:=
cmd
.
Process
.
Kill
();
err
!=
nil
{
log
.
Error
(
4
,
"failed to kill: %v"
,
err
)
}
...
...
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